summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/browser_main_parts_qt.cpp2
-rw-r--r--src/core/web_engine_context.cpp23
-rw-r--r--src/core/web_engine_context.h4
-rw-r--r--src/core/web_engine_context_threads.cpp4
4 files changed, 18 insertions, 15 deletions
diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp
index 925c18664..45056fec2 100644
--- a/src/core/browser_main_parts_qt.cpp
+++ b/src/core/browser_main_parts_qt.cpp
@@ -190,7 +190,7 @@ private:
}
private:
- bool m_enabled = !QOpenGLContext::supportsThreadedOpenGL();
+ bool m_enabled = WebEngineContext::isGpuServiceOnUIThread();
#endif // QT_CONFIG(opengl)
};
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 7cc84eae7..11692c2d1 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -496,6 +496,17 @@ const static char kChromiumFlagsEnv[] = "QTWEBENGINE_CHROMIUM_FLAGS";
const static char kDisableSandboxEnv[] = "QTWEBENGINE_DISABLE_SANDBOX";
const static char kDisableInProcGpuThread[] = "QTWEBENGINE_DISABLE_GPU_THREAD";
+// static
+bool WebEngineContext::isGpuServiceOnUIThread()
+{
+ static bool threadedGpu =
+#if QT_CONFIG(opengl) && !defined(Q_OS_MACOS)
+ QOpenGLContext::supportsThreadedOpenGL() &&
+#endif
+ !qEnvironmentVariableIsSet(kDisableInProcGpuThread);
+ return !threadedGpu;
+}
+
static void appendToFeatureList(std::string &featureList, const char *feature)
{
if (featureList.empty())
@@ -606,16 +617,6 @@ WebEngineContext::WebEngineContext()
if (isDesktopGLOrSoftware || isGLES2Context)
parsedCommandLine->AppendSwitch(switches::kDisableES3GLContext);
#endif
- bool threadedGpu = false;
-#if QT_CONFIG(opengl)
- threadedGpu = QOpenGLContext::supportsThreadedOpenGL();
-#if defined(Q_OS_MACOS)
- // QtBase disabled it when building on 10.14+, unfortunately we still need it
- // until we have fixed single-threaded viz-display-compositor.
- threadedGpu = true;
-#endif
-#endif
- threadedGpu = threadedGpu && !qEnvironmentVariableIsSet(kDisableInProcGpuThread);
bool enableViz = !parsedCommandLine->HasSwitch("disable-viz-display-compositor");
parsedCommandLine->RemoveSwitch("disable-viz-display-compositor");
@@ -774,7 +775,7 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(switches::kDisableGpu);
}
- registerMainThreadFactories(threadedGpu);
+ registerMainThreadFactories();
SetContentClient(new ContentClientQt);
diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h
index 6cbd5c8e5..e2190f8a2 100644
--- a/src/core/web_engine_context.h
+++ b/src/core/web_engine_context.h
@@ -123,13 +123,15 @@ public:
static gpu::SyncPointManager *syncPointManager();
+ static bool isGpuServiceOnUIThread();
+
private:
friend class base::RefCounted<WebEngineContext>;
friend class ProfileAdapter;
WebEngineContext();
~WebEngineContext();
- static void registerMainThreadFactories(bool threaded);
+ static void registerMainThreadFactories();
static void destroyGpuProcess();
std::unique_ptr<base::RunLoop> m_runLoop;
diff --git a/src/core/web_engine_context_threads.cpp b/src/core/web_engine_context_threads.cpp
index ba3e18499..5f9e345f7 100644
--- a/src/core/web_engine_context_threads.cpp
+++ b/src/core/web_engine_context_threads.cpp
@@ -125,11 +125,11 @@ void WebEngineContext::destroyGpuProcess()
}
// static
-void WebEngineContext::registerMainThreadFactories(bool threaded)
+void WebEngineContext::registerMainThreadFactories()
{
content::UtilityProcessHost::RegisterUtilityMainThreadFactory(content::CreateInProcessUtilityThread);
content::RenderProcessHostImpl::RegisterRendererMainThreadFactory(content::CreateInProcessRendererThread);
- if (threaded)
+ if (!isGpuServiceOnUIThread())
content::RegisterGpuMainThreadFactory(content::CreateInProcessGpuThread);
else
content::RegisterGpuMainThreadFactory(createGpuThreadController);