diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 15:28:34 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 13:54:51 +0000 |
commit | 2a19c63448c84c1805fb1a585c3651318bb86ca7 (patch) | |
tree | eb17888e8531aa6ee5e85721bd553b832a7e5156 /chromium/content/gpu | |
parent | b014812705fc80bff0a5c120dfcef88f349816dc (diff) | |
download | qtwebengine-chromium-2a19c63448c84c1805fb1a585c3651318bb86ca7.tar.gz |
BASELINE: Update Chromium to 69.0.3497.70
Change-Id: I2b7b56e4e7a8b26656930def0d4575dc32b900a0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/content/gpu')
-rw-r--r-- | chromium/content/gpu/BUILD.gn | 1 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_child_thread.cc | 40 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_child_thread.h | 15 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_main.cc | 21 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_service_factory.cc | 6 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_service_factory.h | 2 | ||||
-rw-r--r-- | chromium/content/gpu/in_process_gpu_thread.cc | 2 | ||||
-rw-r--r-- | chromium/content/gpu/in_process_gpu_thread.h | 2 |
8 files changed, 57 insertions, 32 deletions
diff --git a/chromium/content/gpu/BUILD.gn b/chromium/content/gpu/BUILD.gn index 9a8b1ca6b4f..ee2cf00ba9a 100644 --- a/chromium/content/gpu/BUILD.gn +++ b/chromium/content/gpu/BUILD.gn @@ -63,7 +63,6 @@ target(link_target_type, "gpu_sources") { "//content/public/common:common_sources", "//gpu:gpu", "//gpu/ipc/common:command_buffer_traits", - "//gpu/ipc/common:gpu_preferences_util", "//gpu/ipc/service", "//ipc", "//media:media_buildflags", diff --git a/chromium/content/gpu/gpu_child_thread.cc b/chromium/content/gpu/gpu_child_thread.cc index 97ca63c7942..aa8847f9780 100644 --- a/chromium/content/gpu/gpu_child_thread.cc +++ b/chromium/content/gpu/gpu_child_thread.cc @@ -7,9 +7,11 @@ #include <stddef.h> #include <utility> +#include "base/allocator/allocator_extension.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/command_line.h" +#include "base/memory/memory_coordinator_client_registry.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" #include "base/sequenced_task_runner.h" @@ -33,7 +35,7 @@ #include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/connector.h" #include "services/viz/privileged/interfaces/gl/gpu_service.mojom.h" -#include "skia/ext/event_tracer_impl.h" +#include "third_party/skia/include/core/SkGraphics.h" #if defined(USE_OZONE) #include "ui/ozone/public/ozone_platform.h" @@ -89,8 +91,7 @@ class QueueingConnectionFilter : public ConnectionFilter { void AddInterfaces() { #if defined(USE_OZONE) - ui::OzonePlatform::GetInstance()->AddInterfaces( - ®istry_with_source_info_); + ui::OzonePlatform::GetInstance()->AddInterfaces(registry_.get()); #endif } @@ -106,10 +107,6 @@ class QueueingConnectionFilter : public ConnectionFilter { mojo::ScopedMessagePipeHandle* interface_pipe, service_manager::Connector* connector) override { DCHECK(io_thread_checker_.CalledOnValidThread()); - if (registry_with_source_info_.TryBindInterface( - interface_name, interface_pipe, source_info)) { - return; - } if (registry_->CanBindInterface(interface_name)) { if (released_) { @@ -138,9 +135,6 @@ class QueueingConnectionFilter : public ConnectionFilter { bool released_ = false; std::vector<std::unique_ptr<PendingRequest>> pending_requests_; std::unique_ptr<service_manager::BinderRegistry> registry_; - service_manager::BinderRegistryWithArgs< - const service_manager::BindSourceInfo&> - registry_with_source_info_; base::WeakPtrFactory<QueueingConnectionFilter> weak_factory_; @@ -193,7 +187,9 @@ GpuChildThread::GpuChildThread(const ChildThreadImpl::Options& options, } } -GpuChildThread::~GpuChildThread() = default; +GpuChildThread::~GpuChildThread() { + base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this); +} void GpuChildThread::Init(const base::Time& process_start_time) { viz_main_.gpu_service()->set_start_time(process_start_time); @@ -229,7 +225,10 @@ void GpuChildThread::Init(const base::Time& process_start_time) { StartServiceManagerConnection(); - InitSkiaEventTracer(); + base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); + memory_pressure_listener_ = + std::make_unique<base::MemoryPressureListener>(base::BindRepeating( + &GpuChildThread::OnMemoryPressure, base::Unretained(this))); } void GpuChildThread::CreateVizMainService( @@ -301,6 +300,23 @@ void GpuChildThread::BindServiceFactoryRequest( std::move(request)); } +void GpuChildThread::OnTrimMemoryImmediately() { + OnPurgeMemory(); +} + +void GpuChildThread::OnMemoryPressure( + base::MemoryPressureListener::MemoryPressureLevel level) { + if (level == base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) + OnPurgeMemory(); +} + +void GpuChildThread::OnPurgeMemory() { + base::allocator::ReleaseFreeMemory(); + if (viz_main_.discardable_shared_memory_manager()) + viz_main_.discardable_shared_memory_manager()->ReleaseFreeMemory(); + SkGraphics::PurgeAllCaches(); +} + #if defined(OS_ANDROID) // static std::unique_ptr<media::AndroidOverlay> GpuChildThread::CreateAndroidOverlay( diff --git a/chromium/content/gpu/gpu_child_thread.h b/chromium/content/gpu/gpu_child_thread.h index 417035ddcb0..6e0481e8ccd 100644 --- a/chromium/content/gpu/gpu_child_thread.h +++ b/chromium/content/gpu/gpu_child_thread.h @@ -14,6 +14,7 @@ #include "base/callback.h" #include "base/command_line.h" #include "base/macros.h" +#include "base/memory/memory_coordinator_client.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" @@ -22,9 +23,9 @@ #include "components/viz/service/main/viz_main_impl.h" #include "content/child/child_thread_impl.h" #include "content/common/associated_interface_registry_impl.h" -#include "gpu/command_buffer/service/gpu_preferences.h" #include "gpu/config/gpu_feature_info.h" #include "gpu/config/gpu_info.h" +#include "gpu/config/gpu_preferences.h" #include "gpu/ipc/service/gpu_channel.h" #include "gpu/ipc/service/gpu_channel_manager.h" #include "gpu/ipc/service/gpu_channel_manager_delegate.h" @@ -46,7 +47,8 @@ class GpuServiceFactory; // IPC messages to gpu::GpuChannelManager, which is responsible for issuing // rendering commands to the GPU. class GpuChildThread : public ChildThreadImpl, - public viz::VizMainImpl::Delegate { + public viz::VizMainImpl::Delegate, + public base::MemoryCoordinatorClient { public: GpuChildThread(std::unique_ptr<gpu::GpuInit> gpu_init, viz::VizMainImpl::LogMessages deferred_messages); @@ -80,6 +82,13 @@ class GpuChildThread : public ChildThreadImpl, void PostCompositorThreadCreated( base::SingleThreadTaskRunner* task_runner) override; + // ChildMemoryCoordinatorDelegate implementation. + void OnTrimMemoryImmediately() override; + // base::MemoryCoordinatorClient implementation: + void OnPurgeMemory() override; + void OnMemoryPressure( + base::MemoryPressureListener::MemoryPressureLevel level); + void BindServiceFactoryRequest( service_manager::mojom::ServiceFactoryRequest request); @@ -104,6 +113,8 @@ class GpuChildThread : public ChildThreadImpl, // Holds a closure that releases pending interface requests on the IO thread. base::Closure release_pending_requests_closure_; + std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; + base::WeakPtrFactory<GpuChildThread> weak_factory_; DISALLOW_COPY_AND_ASSIGN(GpuChildThread); diff --git a/chromium/content/gpu/gpu_main.cc b/chromium/content/gpu/gpu_main.cc index e6a589fb90e..f14c045d47a 100644 --- a/chromium/content/gpu/gpu_main.cc +++ b/chromium/content/gpu/gpu_main.cc @@ -24,6 +24,7 @@ #include "components/viz/service/main/viz_main_impl.h" #include "content/common/content_constants_internal.h" #include "content/common/content_switches_internal.h" +#include "content/common/skia_utils.h" #include "content/gpu/gpu_child_thread.h" #include "content/gpu/gpu_process.h" #include "content/public/common/content_client.h" @@ -34,16 +35,15 @@ #include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/config/gpu_driver_bug_list.h" #include "gpu/config/gpu_info_collector.h" +#include "gpu/config/gpu_preferences.h" #include "gpu/config/gpu_switches.h" #include "gpu/config/gpu_util.h" #include "gpu/ipc/common/gpu_memory_buffer_support.h" -#include "gpu/ipc/common/gpu_preferences_util.h" #include "gpu/ipc/service/gpu_config.h" #include "gpu/ipc/service/gpu_init.h" #include "gpu/ipc/service/gpu_watchdog_thread.h" #include "media/gpu/buildflags.h" #include "third_party/angle/src/gpu_info_util/SystemInfo.h" -#include "third_party/skia/include/core/SkGraphics.h" #include "ui/events/platform/platform_event_source.h" #include "ui/gfx/switches.h" #include "ui/gl/gl_context.h" @@ -78,12 +78,10 @@ #endif #if defined(OS_LINUX) -#include "content/common/font_config_ipc_linux.h" #include "content/gpu/gpu_sandbox_hook_linux.h" #include "content/public/common/sandbox_init.h" #include "services/service_manager/sandbox/linux/sandbox_linux.h" #include "services/service_manager/zygote/common/common_sandbox_support_linux.h" -#include "third_party/skia/include/ports/SkFontConfigInterface.h" #endif #if defined(OS_MACOSX) @@ -206,7 +204,7 @@ int GpuMain(const MainFunctionParams& parameters) { if (command_line.HasSwitch(switches::kGpuPreferences)) { std::string value = command_line.GetSwitchValueASCII(switches::kGpuPreferences); - bool success = gpu::SwitchValueToGpuPreferences(value, &gpu_preferences); + bool success = gpu_preferences.FromSwitchValue(value); CHECK(success); } @@ -299,6 +297,10 @@ int GpuMain(const MainFunctionParams& parameters) { gpu_init->set_sandbox_helper(&sandbox_helper); + // Since GPU initialization calls into skia, its important to initialize skia + // before it. + InitializeSkia(); + // Gpu initialization may fail for various reasons, in which case we will need // to tear down this process. However, we can not do so safely until the IPC // channel is set up, because the detection of early return of a child process @@ -339,15 +341,6 @@ int GpuMain(const MainFunctionParams& parameters) { nullptr); #endif - if (gpu_preferences.enable_oop_rasterization) { - SkGraphics::Init(); -#if defined(OS_LINUX) - // Set up the font IPC so that the GPU process can create typefaces. - SkFontConfigInterface::SetGlobal( - sk_make_sp<FontConfigIPC>(service_manager::GetSandboxFD())); -#endif - } - base::HighResolutionTimerManager hi_res_timer_manager; { diff --git a/chromium/content/gpu/gpu_service_factory.cc b/chromium/content/gpu/gpu_service_factory.cc index fc73e43a5c8..844125a7c6c 100644 --- a/chromium/content/gpu/gpu_service_factory.cc +++ b/chromium/content/gpu/gpu_service_factory.cc @@ -8,6 +8,7 @@ #include "base/task_scheduler/post_task.h" #include "base/threading/thread_task_runner_handle.h" +#include "build/build_config.h" #include "services/shape_detection/public/mojom/constants.mojom.h" #include "services/shape_detection/shape_detection_service.h" @@ -54,9 +55,14 @@ void GpuServiceFactory::RegisterServices(ServiceMap* services) { // This service will host audio/video decoders, and if these decoding // operations are blocked, user may hear audio glitch or see video freezing, // hence "user blocking". +#if defined(OS_WIN) + // Run everything on the gpu main thread, since that's where the CDM runs. + info.task_runner = task_runner_; +#else // TODO(crbug.com/786169): Check whether this needs to be single threaded. info.task_runner = base::CreateSingleThreadTaskRunnerWithTraits( {base::TaskPriority::USER_BLOCKING}); +#endif // defined(OS_WIN) services->insert(std::make_pair("media", info)); #endif // BUILDFLAG(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) diff --git a/chromium/content/gpu/gpu_service_factory.h b/chromium/content/gpu/gpu_service_factory.h index 6644f0d0079..1316a948e2d 100644 --- a/chromium/content/gpu/gpu_service_factory.h +++ b/chromium/content/gpu/gpu_service_factory.h @@ -10,8 +10,8 @@ #include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" #include "content/child/service_factory.h" -#include "gpu/command_buffer/service/gpu_preferences.h" #include "gpu/config/gpu_driver_bug_workarounds.h" +#include "gpu/config/gpu_preferences.h" #include "media/base/android_overlay_mojo_factory.h" #include "media/mojo/buildflags.h" diff --git a/chromium/content/gpu/in_process_gpu_thread.cc b/chromium/content/gpu/in_process_gpu_thread.cc index 1efa57c23e7..8c83f439f58 100644 --- a/chromium/content/gpu/in_process_gpu_thread.cc +++ b/chromium/content/gpu/in_process_gpu_thread.cc @@ -11,7 +11,7 @@ #include "content/gpu/gpu_process.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" -#include "gpu/command_buffer/service/gpu_preferences.h" +#include "gpu/config/gpu_preferences.h" #include "gpu/ipc/service/gpu_init.h" #if defined(OS_ANDROID) diff --git a/chromium/content/gpu/in_process_gpu_thread.h b/chromium/content/gpu/in_process_gpu_thread.h index c8e96e88d47..12b24cad398 100644 --- a/chromium/content/gpu/in_process_gpu_thread.h +++ b/chromium/content/gpu/in_process_gpu_thread.h @@ -11,7 +11,7 @@ #include "base/threading/thread.h" #include "content/common/content_export.h" #include "content/common/in_process_child_thread_params.h" -#include "gpu/command_buffer/service/gpu_preferences.h" +#include "gpu/config/gpu_preferences.h" namespace content { |