summaryrefslogtreecommitdiffstats
path: root/src/core/web_engine_context_threads.cpp
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2020-01-16 11:51:23 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-30 13:40:04 +0100
commit7f1649b438329ec4f698389bbc44ee8d694e4801 (patch)
tree6dffd749ee94f8d488ad2eccda2d58c9fc8040c4 /src/core/web_engine_context_threads.cpp
parent97b047203345474cc9733f801cc5a447040bcea5 (diff)
Cleanup FrameSinkManagerImpl before shutting down GPU service
We changed RootCompositorFrameSinks to be destroyed asynchronously (in HostFrameSinkManager::InvalidateFrameSinkId) which means that one can still exist during shutdown in GpuThreadControllerQt::destroyGpuProcess. This results in a deadlock in single threaded GPU mode: in destroyGpuProcess we wait for the viz thread to exit, but the FrameSinkManagerImpl on the viz thread will try to destroy the RootCompositorFrameSink, which waits for work to be done on the GPU=UI thread, which is waiting for the viz thread to exit. Fix by destroying all RootCompositorFrameSinks before destroyGpuProcess. Change-Id: I4cf135f29b90ae0bf78525d5747567dc10a775e6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/web_engine_context_threads.cpp')
-rw-r--r--src/core/web_engine_context_threads.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/core/web_engine_context_threads.cpp b/src/core/web_engine_context_threads.cpp
index e92cf3e9b..f0f055676 100644
--- a/src/core/web_engine_context_threads.cpp
+++ b/src/core/web_engine_context_threads.cpp
@@ -57,6 +57,8 @@
#include <memory>
+#include <QEventLoop>
+
namespace QtWebEngineCore {
struct GpuThreadControllerQt : content::GpuThreadController
@@ -90,6 +92,20 @@ struct GpuThreadControllerQt : content::GpuThreadController
s_gpuProcess->set_main_thread(childThread);
}
+ static void cleanupVizProcess()
+ {
+ auto gpuChildThread = content::GpuChildThread::instance();
+ if (!gpuChildThread)
+ return;
+ auto vizMain = gpuChildThread->viz_main();
+ auto vizCompositorThreadRunner = vizMain->viz_compositor_thread_runner();
+ if (!vizCompositorThreadRunner)
+ return;
+ QEventLoop loop;
+ vizCompositorThreadRunner->CleanupForShutdown(base::BindOnce(&QEventLoop::quit, base::Unretained(&loop)));
+ loop.exec();
+ }
+
static void destroyGpuProcess()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -117,8 +133,10 @@ static std::unique_ptr<content::GpuThreadController> createGpuThreadController(
}
// static
-void WebEngineContext::destroyGpuProcess()
+void WebEngineContext::destroyGpuProcess(bool threaded)
{
+ if (!threaded)
+ GpuThreadControllerQt::cleanupVizProcess();
GpuThreadControllerQt::destroyGpuProcess();
}