summaryrefslogtreecommitdiffstats
path: root/src/core/web_engine_context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/web_engine_context.cpp')
-rw-r--r--src/core/web_engine_context.cpp90
1 files changed, 33 insertions, 57 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 01d55a5a1..bfb34c484 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -127,11 +127,11 @@
#include <QOffscreenSurface>
#if QT_CONFIG(opengl)
# include <QOpenGLContext>
+# include <qopenglcontext_platform.h>
#endif
#include <QQuickWindow>
#include <QStringList>
#include <QSurfaceFormat>
-#include <QVector>
#include <QNetworkProxy>
#include <QtGui/qpa/qplatformintegration.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -204,12 +204,13 @@ sandbox::SandboxInterfaceInfo *staticSandboxInterfaceInfo(sandbox::SandboxInterf
extern std::unique_ptr<base::MessagePump> messagePumpFactory();
+// used from gl_surface_qt.cpp
bool usingSoftwareDynamicGL()
{
if (QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL))
return true;
#if defined(Q_OS_WIN) && QT_CONFIG(opengl)
- HMODULE handle = static_cast<HMODULE>(QOpenGLContext::openGLModuleHandle());
+ HMODULE handle = QPlatformInterface::QWGLContext::openGLModuleHandle();
wchar_t path[MAX_PATH];
DWORD size = GetModuleFileName(handle, path, MAX_PATH);
QFileInfo openGLModule(QString::fromWCharArray(path, size));
@@ -219,21 +220,22 @@ bool usingSoftwareDynamicGL()
#endif
}
-void setupProxyPac(base::CommandLine *commandLine){
+static void setupProxyPac(base::CommandLine *commandLine)
+{
if (commandLine->HasSwitch(switches::kProxyPacUrl)) {
QUrl pac_url(toQt(commandLine->GetSwitchValueASCII(switches::kProxyPacUrl)));
if (pac_url.isValid() && (pac_url.isLocalFile() ||
- !pac_url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive))) {
+ !pac_url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive))) {
QFile file;
if (pac_url.isLocalFile())
- file.setFileName(pac_url.toLocalFile());
+ file.setFileName(pac_url.toLocalFile());
else
- file.setFileName(pac_url.path().prepend(QChar(':')));
+ file.setFileName(pac_url.path().prepend(QChar(':')));
if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QByteArray ba = file.readAll();
- commandLine->RemoveSwitch(switches::kProxyPacUrl);
- commandLine->AppendSwitchASCII(switches::kProxyPacUrl,
- ba.toBase64().prepend("data:application/x-javascript-config;base64,").toStdString());
+ QByteArray ba = file.readAll();
+ commandLine->RemoveSwitch(switches::kProxyPacUrl);
+ commandLine->AppendSwitchASCII(switches::kProxyPacUrl,
+ ba.toBase64().prepend("data:application/x-javascript-config;base64,").toStdString());
}
}
}
@@ -360,12 +362,10 @@ void WebEngineContext::destroy()
// 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.
- if (features::IsVizDisplayCompositorEnabled()) {
- cleanupVizProcess();
- while (waitForViz) {
- while (delegate->DoWork()){}
- QThread::msleep(50);
- }
+ cleanupVizProcess();
+ while (waitForViz) {
+ while (delegate->DoWork()){}
+ QThread::msleep(50);
}
destroyGpuProcess();
// Flush the UI message loop before quitting.
@@ -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,19 +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");
std::string disableFeatures;
std::string enableFeatures;
@@ -663,28 +661,6 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(cc::switches::kDisableCompositedAntialiasing);
}
- if (!enableViz) {
- // These are currently only default on OS X, and we don't support them:
- parsedCommandLine->AppendSwitch(switches::kDisableZeroCopy);
- parsedCommandLine->AppendSwitch(switches::kDisableGpuMemoryBufferCompositorResources);
-
- // Enabled on OS X and Linux but currently not working. It worked in 5.7 on OS X.
- parsedCommandLine->AppendSwitch(switches::kDisableGpuMemoryBufferVideoFrames);
-
-#if defined(Q_OS_MACOS)
- // Accelerated decoding currently does not work on macOS due to issues with OpenGL Rectangle
- // texture support. See QTBUG-60002.
- parsedCommandLine->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
- // Same problem with Pepper using OpenGL images.
- parsedCommandLine->AppendSwitch(switches::kDisablePepper3DImageChromium);
-#endif
-
- // Viz Display Compositor is enabled by default since 73. Doesn't work for us (also implies SurfaceSynchronization)
- appendToFeatureList(disableFeatures, features::kVizDisplayCompositor.name);
- // VideoSurfaceLayer is enabled by default since 75. We don't support it.
- appendToFeatureList(enableFeatures, media::kDisableSurfaceLayerForVideo.name);
- }
-
appendToFeatureSwitch(parsedCommandLine, switches::kDisableFeatures, disableFeatures);
appendToFeatureSwitch(parsedCommandLine, switches::kEnableFeatures, enableFeatures);
base::FeatureList::InitializeInstance(
@@ -702,12 +678,12 @@ WebEngineContext::WebEngineContext()
if (tryGL) {
if (qt_gl_global_share_context() && qt_gl_global_share_context()->isValid()) {
// If the native handle is QEGLNativeContext try to use GL ES/2.
- // If there is no native handle, assume we are using wayland and try GL ES/2.
// If we are using ANGLE on Windows, use OpenGL ES (2 or 3).
- if (qt_gl_global_share_context()->nativeHandle().isNull()
- || !strcmp(qt_gl_global_share_context()->nativeHandle().typeName(),
- "QEGLNativeContext")
- || usingANGLE())
+ if (
+#if QT_CONFIG(egl)
+ qt_gl_global_share_context()->platformInterface<QPlatformInterface::QEGLContext>() ||
+#endif
+ usingANGLE())
{
if (qt_gl_global_share_context()->isOpenGLES()) {
glType = usingANGLE() ? gl::kGLImplementationANGLEName : gl::kGLImplementationEGLName;
@@ -773,7 +749,7 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(switches::kDisableGpu);
}
- registerMainThreadFactories(threadedGpu);
+ registerMainThreadFactories();
SetContentClient(new ContentClientQt);