mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Wait for CefBrowserContext initialization (see issue #2969)
With the Chrome runtime, Profile initialization may be asynchronous. Code that waited on CefBrowserContext creation now needs to wait on CefBrowserContext initialization instead.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "libcef/browser/context.h"
|
||||
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/trace_subscriber.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
@@ -474,12 +475,19 @@ bool CefContext::HasObserver(Observer* observer) const {
|
||||
void CefContext::OnContextInitialized() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// Notify the handler.
|
||||
if (application_) {
|
||||
CefRefPtr<CefBrowserProcessHandler> handler =
|
||||
application_->GetBrowserProcessHandler();
|
||||
if (handler)
|
||||
handler->OnContextInitialized();
|
||||
// Notify the handler after the global browser context has initialized.
|
||||
CefRefPtr<CefRequestContext> request_context =
|
||||
CefRequestContext::GetGlobalContext();
|
||||
auto impl = static_cast<CefRequestContextImpl*>(request_context.get());
|
||||
impl->ExecuteWhenBrowserContextInitialized(base::BindOnce(
|
||||
[](CefRefPtr<CefApp> app) {
|
||||
CefRefPtr<CefBrowserProcessHandler> handler =
|
||||
app->GetBrowserProcessHandler();
|
||||
if (handler)
|
||||
handler->OnContextInitialized();
|
||||
},
|
||||
application_));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user