Restore async CreateBrowser behavior (fixes issue #3116, fixes issue #3118)

Restore the async CreateBrowser behavior that existed prior to commit 691c9c2
because executing synchronously (for example, from inside OnContextInitialized)
causes issues on MacOS and possibly other platforms.
This commit is contained in:
Marshall Greenblatt
2021-04-29 17:07:36 -04:00
parent 5c92ffb78d
commit c53c523f4d

View File

@@ -88,7 +88,12 @@ bool CefBrowserHost::CreateBrowser(
// Wait for the browser context to be initialized before creating the browser.
request_context_impl->ExecuteWhenBrowserContextInitialized(base::BindOnce(
[](std::unique_ptr<CreateBrowserHelper> helper) { helper->Run(); },
[](std::unique_ptr<CreateBrowserHelper> helper) {
// Always execute asynchronously to avoid potential issues if we're
// being called synchronously during app initialization.
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CreateBrowserHelper::Run,
std::move(helper)));
},
std::move(helper)));
return true;