- Code: Select all
web_browser.cpp
//-----------------------------------------------------------------------------
Browser::Browser() {
CefBrowserSettings browser_settings;
CefWindowInfo window_info;
window_info.SetAsWindowless( nullptr );
window_info.shared_texture_enabled = true;
CefBrowserHost::CreateBrowser( window_info, GetClient(),
"www.google.com", browser_settings, nullptr );
}
web_client.cpp
//-----------------------------------------------------------------------------
void Client::OnAfterCreated( CefRefPtr<CefBrowser> browser ) {
// Assign this new CEF browser object to the Browser that created it.
// >>> But how do I forward the reference to the original Browser to here? <<<
}
If I'm doing something not recommended with this design please let me know too.
My current solution in mind is to keep a queue of Browser objects in the Client that are waiting for their CEF browser to be created, but I'd like to avoid that as it seems more like a workaround rather than a proper solution, not to mention safety concerns from an additional cog in the multithreaded system.