Windows: cefclient: Fix assertions with --use-views --multi-threaded-message-loop

This commit is contained in:
Marshall Greenblatt
2019-11-18 15:02:39 -05:00
parent 319de22d89
commit f9706f260a
3 changed files with 26 additions and 17 deletions

View File

@@ -107,8 +107,7 @@ class ClientRequestContextHandler : public CefRequestContextHandler,
} // namespace
RootWindowManager::RootWindowManager(bool terminate_when_all_windows_closed)
: terminate_when_all_windows_closed_(terminate_when_all_windows_closed),
image_cache_(new ImageCache) {
: terminate_when_all_windows_closed_(terminate_when_all_windows_closed) {
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
DCHECK(command_line.get());
@@ -354,8 +353,11 @@ CefRefPtr<CefRequestContext> RootWindowManager::GetRequestContext(
}
scoped_refptr<ImageCache> RootWindowManager::GetImageCache() {
REQUIRE_MAIN_THREAD();
CEF_REQUIRE_UI_THREAD();
if (!image_cache_) {
image_cache_ = new ImageCache;
}
return image_cache_;
}
@@ -446,6 +448,10 @@ void RootWindowManager::CleanupOnUIThread() {
temp_window_.reset(nullptr);
}
if (image_cache_) {
image_cache_ = nullptr;
}
// Quit the main message loop.
MainMessageLoop::Get()->Quit();
}