diff options
Diffstat (limited to 'src/core/web_engine_context.cpp')
-rw-r--r-- | src/core/web_engine_context.cpp | 68 |
1 files changed, 47 insertions, 21 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 286842a20..cd2ff8be5 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -47,8 +47,10 @@ #include "base/run_loop.h" #include "base/task/post_task.h" #include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h" +#include "base/task/thread_pool/thread_pool_instance.h" #include "base/threading/thread_restrictions.h" #include "cc/base/switches.h" +#include "chrome/common/chrome_switches.h" #include "content/gpu/gpu_child_thread.h" #include "content/browser/compositor/surface_utils.h" #include "components/viz/host/host_frame_sink_manager.h" @@ -76,6 +78,7 @@ #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" +#include "content/public/common/network_service_util.h" #include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/command_buffer/service/sync_point_manager.h" #include "media/audio/audio_manager.h" @@ -85,8 +88,9 @@ #include "ppapi/buildflags/buildflags.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/network_switches.h" -#include "services/resource_coordinator/public/cpp/resource_coordinator_features.h" +#include "services/network/public/mojom/network_context.mojom.h" #include "services/service_manager/sandbox/switches.h" +#include "services/tracing/public/cpp/trace_startup.h" #include "services/tracing/public/cpp/tracing_features.h" #include "third_party/blink/public/common/features.h" #include "ui/events/event_switches.h" @@ -214,6 +218,21 @@ bool usingSoftwareDynamicGL() #endif } +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()) { + QFile file(pac_url.toLocalFile()); + 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()); + } + } + } +} + static bool waitForViz = false; static void completeVizCleanup() { @@ -491,7 +510,7 @@ WebEngineContext::WebEngineContext() #endif base::CommandLine* parsedCommandLine = commandLine(); - + setupProxyPac(parsedCommandLine); parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE)); // Enable sandboxing on OS X and Linux (Desktop / Embedded) by default. @@ -506,20 +525,6 @@ WebEngineContext::WebEngineContext() } parsedCommandLine->AppendSwitch(switches::kEnableThreadedCompositing); - // 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 #if defined(Q_OS_WIN) // This switch is used in Chromium's gl_context_wgl.cc file to determine whether to create @@ -547,6 +552,11 @@ WebEngineContext::WebEngineContext() bool threadedGpu = false; #ifndef QT_NO_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); @@ -564,14 +574,15 @@ WebEngineContext::WebEngineContext() appendToFeatureList(enableFeatures, features::kAllowContentInitiatedDataUrlNavigations.name); appendToFeatureList(enableFeatures, features::kTracingServiceInProcess.name); + appendToFeatureList(enableFeatures, features::kNetworkServiceInProcess.name); // The video-capture service is not functioning at this moment (since 69) appendToFeatureList(disableFeatures, features::kMojoVideoCapture.name); - // We do not yet support the network-service, but it is enabled by default since 75. - appendToFeatureList(disableFeatures, network::features::kNetworkService.name); - // BlinkGenPropertyTrees is enabled by default in 75, but causes regressions. - appendToFeatureList(disableFeatures, blink::features::kBlinkGenPropertyTrees.name); +#if defined(Q_OS_LINUX) + // broken and crashy (even upstream): + appendToFeatureList(disableFeatures, features::kFontSrcLocalMatching.name); +#endif #if QT_CONFIG(webengine_printing_and_pdf) appendToFeatureList(disableFeatures, printing::features::kUsePdfCompositorServiceForPrint.name); @@ -579,7 +590,6 @@ WebEngineContext::WebEngineContext() // Explicitly tell Chromium about default-on features we do not support appendToFeatureList(disableFeatures, features::kBackgroundFetch.name); - appendToFeatureList(disableFeatures, features::kOriginTrials.name); appendToFeatureList(disableFeatures, features::kSmsReceiver.name); appendToFeatureList(disableFeatures, features::kWebAuth.name); appendToFeatureList(disableFeatures, features::kWebAuthCable.name); @@ -595,6 +605,21 @@ WebEngineContext::WebEngineContext() } 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. @@ -715,6 +740,7 @@ WebEngineContext::WebEngineContext() m_mainDelegate->PostEarlyInitialization(false); content::StartBrowserThreadPool(); content::BrowserTaskExecutor::PostFeatureListSetup(); + tracing::InitTracingPostThreadPoolStartAndFeatureList(); m_discardableSharedMemoryManager = std::make_unique<discardable_memory::DiscardableSharedMemoryManager>(); m_serviceManagerEnvironment = std::make_unique<content::ServiceManagerEnvironment>(content::BrowserTaskExecutor::CreateIOThread()); m_startupData = m_serviceManagerEnvironment->CreateBrowserStartupData(); |