cefclient: Move StringResourceMap to ClientHandler (see issue #2586)

Fixes a DCHECK when creating multiple windows in cefclient due to the creation
of multiple StringResourceProvider objects.
This commit is contained in:
Marshall Greenblatt
2019-10-18 15:30:53 +02:00
parent 329facfbdf
commit aad4bf2464
4 changed files with 41 additions and 32 deletions

View File

@@ -260,7 +260,7 @@ ClientHandler::ClientHandler(Delegate* delegate,
#endif
resource_manager_ = new CefResourceManager();
test_runner::SetupResourceManager(resource_manager_);
test_runner::SetupResourceManager(resource_manager_, &string_resource_map_);
// Read command line settings.
CefRefPtr<CefCommandLine> command_line =
@@ -973,6 +973,17 @@ void ClientHandler::ShowSSLInformation(CefRefPtr<CefBrowser> browser) {
MainContext::Get()->GetRootWindowManager()->CreateRootWindow(config);
}
void ClientHandler::SetStringResource(const std::string& page,
const std::string& data) {
if (!CefCurrentlyOn(TID_IO)) {
CefPostTask(TID_IO, base::Bind(&ClientHandler::SetStringResource, this,
page, data));
return;
}
string_resource_map_[page] = data;
}
bool ClientHandler::CreatePopupWindow(CefRefPtr<CefBrowser> browser,
bool is_devtools,
const CefPopupFeatures& popupFeatures,