mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Linux: Add multi-threaded message loop support (issue #2512)
This commit is contained in:
@@ -159,6 +159,11 @@ scoped_refptr<RootWindow> RootWindowManager::CreateRootWindowAsPopup(
|
||||
CefBrowserSettings& settings) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
if (!temp_window_) {
|
||||
// TempWindow must be created on the UI thread.
|
||||
temp_window_.reset(new TempWindow());
|
||||
}
|
||||
|
||||
MainContext::Get()->PopulateBrowserSettings(&settings);
|
||||
|
||||
scoped_refptr<RootWindow> root_window =
|
||||
@@ -390,8 +395,9 @@ void RootWindowManager::OnRootWindowDestroyed(RootWindow* root_window) {
|
||||
}
|
||||
|
||||
if (terminate_when_all_windows_closed_ && root_windows_.empty()) {
|
||||
// Quit the main message loop after all windows have closed.
|
||||
MainMessageLoop::Get()->Quit();
|
||||
// All windows have closed. Clean up on the UI thread.
|
||||
CefPostTask(TID_UI, base::Bind(&RootWindowManager::CleanupOnUIThread,
|
||||
base::Unretained(this)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,4 +446,16 @@ void RootWindowManager::CreateExtensionWindow(
|
||||
}
|
||||
}
|
||||
|
||||
void RootWindowManager::CleanupOnUIThread() {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
if (temp_window_) {
|
||||
// TempWindow must be destroyed on the UI thread.
|
||||
temp_window_.reset(nullptr);
|
||||
}
|
||||
|
||||
// Quit the main message loop.
|
||||
MainMessageLoop::Get()->Quit();
|
||||
}
|
||||
|
||||
} // namespace client
|
||||
|
Reference in New Issue
Block a user