diff options
-rw-r--r-- | src/core/profile_qt.cpp | 1 | ||||
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 1 | ||||
-rw-r--r-- | src/core/web_engine_context.cpp | 18 | ||||
-rw-r--r-- | src/core/web_engine_context.h | 1 |
4 files changed, 15 insertions, 6 deletions
diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp index 748104312..dac6658e2 100644 --- a/src/core/profile_qt.cpp +++ b/src/core/profile_qt.cpp @@ -112,6 +112,7 @@ ProfileQt::~ProfileQt() DCHECK_CURRENTLY_ON(content::BrowserThread::UI); m_prefServiceAdapter.commit(); content::BrowserContext::NotifyWillBeDestroyed(this); + WebEngineContext::flushMessages(); BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(this); ShutdownStoragePartitions(); m_profileIOData->shutdownOnUIThread(); diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 4dd999115..2427d47bc 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -383,6 +383,7 @@ RenderWidgetHostViewQt::~RenderWidgetHostViewQt() m_touchSelectionControllerClient.reset(); host()->render_frame_metadata_provider()->RemoveObserver(this); + host()->ViewDestroyed(); } void RenderWidgetHostViewQt::setDelegate(RenderWidgetHostViewQtDelegate* delegate) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 863b46a57..41db33cd4 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -354,6 +354,15 @@ void WebEngineContext::removeProfileAdapter(ProfileAdapter *profileAdapter) m_profileAdapters.removeAll(profileAdapter); } +void WebEngineContext::flushMessages() +{ + if (!m_destroyed) { + base::MessagePump::Delegate *delegate = static_cast< + base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl *>( + WebEngineContext::current()->m_runLoop->delegate_); + while (delegate->DoWork().is_immediate()) { } + } +} void WebEngineContext::destroy() { if (m_devtoolsServer) @@ -364,20 +373,17 @@ void WebEngineContext::destroy() m_webrtcLogUploader->Shutdown(); #endif - base::MessagePump::Delegate *delegate = - static_cast<base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl *>( - m_runLoop->delegate_); // Normally the GPU thread is shut down when the GpuProcessHost is destroyed // on IO thread (triggered by ~BrowserMainRunner). But by that time the UI // task runner is not working anymore so we need to do this earlier. cleanupVizProcess(); while (waitForViz) { - while (delegate->DoWork().is_immediate()) { } + flushMessages(); QThread::msleep(50); } destroyGpuProcess(); // Flush the UI message loop before quitting. - while (delegate->DoWork().is_immediate()) { } + flushMessages(); #if QT_CONFIG(webengine_printing_and_pdf) // Kill print job manager early as it has a content::NotificationRegistrar @@ -399,7 +405,7 @@ void WebEngineContext::destroy() // Handle any events posted by browser-context shutdown. // This should deliver all nessesery calls of DeleteSoon from PostTask - while (delegate->DoWork().is_immediate()) { } + flushMessages(); m_devtoolsServer.reset(); m_runLoop->AfterRun(); diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index a74b83eae..f60082059 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -108,6 +108,7 @@ public: static WebEngineContext *current(); static void destroyContextPostRoutine(); static ProxyAuthentication qProxyNetworkAuthentication(QString host, int port); + static void flushMessages(); ProfileAdapter *createDefaultProfileAdapter(); ProfileAdapter *defaultProfileAdapter(); |