diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-13 15:05:36 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-14 10:33:47 +0000 |
commit | e684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch) | |
tree | d55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/content/gpu | |
parent | 2b94bfe47ccb6c08047959d1c26e392919550e86 (diff) | |
download | qtwebengine-chromium-e684a3455bcc29a6e3e66a004e352dea4e1141e7.tar.gz |
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/content/gpu')
-rw-r--r-- | chromium/content/gpu/BUILD.gn | 2 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_child_thread.cc | 13 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_child_thread.h | 8 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_main.cc | 7 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_sandbox_hook_linux.cc | 12 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_service_factory.cc | 67 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_service_factory.h | 4 |
7 files changed, 66 insertions, 47 deletions
diff --git a/chromium/content/gpu/BUILD.gn b/chromium/content/gpu/BUILD.gn index 8974e441d1b..d9d707b1a95 100644 --- a/chromium/content/gpu/BUILD.gn +++ b/chromium/content/gpu/BUILD.gn @@ -75,6 +75,8 @@ target(link_target_type, "gpu_sources") { "//components/viz/service/main", "//media/gpu/ipc/service", "//media/mojo/clients:clients", + "//media/mojo/interfaces:constants", + "//services/service_manager/embedder", "//services/service_manager/public/cpp", "//services/service_manager/public/mojom", "//services/service_manager/sandbox:chromecast_sandbox_whitelist_buildflags", diff --git a/chromium/content/gpu/gpu_child_thread.cc b/chromium/content/gpu/gpu_child_thread.cc index 66a559d42e7..2f0c17fd8e0 100644 --- a/chromium/content/gpu/gpu_child_thread.cc +++ b/chromium/content/gpu/gpu_child_thread.cc @@ -11,7 +11,6 @@ #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" @@ -194,7 +193,6 @@ GpuChildThread::GpuChildThread(base::RepeatingClosure quit_closure, } GpuChildThread::~GpuChildThread() { - base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this); } void GpuChildThread::Init(const base::Time& process_start_time) { @@ -231,7 +229,6 @@ void GpuChildThread::Init(const base::Time& process_start_time) { StartServiceManagerConnection(); - base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); memory_pressure_listener_ = std::make_unique<base::MemoryPressureListener>(base::BindRepeating( &GpuChildThread::OnMemoryPressure, base::Unretained(this))); @@ -309,17 +306,11 @@ 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(); -} + if (level != base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) + return; -void GpuChildThread::OnPurgeMemory() { base::allocator::ReleaseFreeMemory(); if (viz_main_.discardable_shared_memory_manager()) viz_main_.discardable_shared_memory_manager()->ReleaseFreeMemory(); diff --git a/chromium/content/gpu/gpu_child_thread.h b/chromium/content/gpu/gpu_child_thread.h index 74560c109cd..6d69712abf5 100644 --- a/chromium/content/gpu/gpu_child_thread.h +++ b/chromium/content/gpu/gpu_child_thread.h @@ -14,7 +14,6 @@ #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" @@ -47,8 +46,7 @@ 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 base::MemoryCoordinatorClient { + public viz::VizMainImpl::Delegate { public: GpuChildThread(base::RepeatingClosure quit_closure, std::unique_ptr<gpu::GpuInit> gpu_init, @@ -85,10 +83,6 @@ class GpuChildThread : public ChildThreadImpl, base::SingleThreadTaskRunner* task_runner) override; void QuitMainMessageLoop() override; - // ChildMemoryCoordinatorDelegate implementation. - void OnTrimMemoryImmediately() override; - // base::MemoryCoordinatorClient implementation: - void OnPurgeMemory() override; void OnMemoryPressure( base::MemoryPressureListener::MemoryPressureLevel level); diff --git a/chromium/content/gpu/gpu_main.cc b/chromium/content/gpu/gpu_main.cc index 8397889b61e..c2061485c91 100644 --- a/chromium/content/gpu/gpu_main.cc +++ b/chromium/content/gpu/gpu_main.cc @@ -15,7 +15,7 @@ #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" -#include "base/sys_info.h" +#include "base/system/sys_info.h" #include "base/threading/platform_thread.h" #include "base/timer/hi_res_timer_manager.h" #include "base/trace_event/trace_event.h" @@ -338,9 +338,8 @@ int GpuMain(const MainFunctionParams& parameters) { gpu_process.set_main_thread(child_thread); // Setup tracing sampler profiler as early as possible. - auto tracing_sampler_profiler = - std::make_unique<tracing::TracingSamplerProfiler>( - base::PlatformThread::CurrentId()); + std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler = + tracing::TracingSamplerProfiler::CreateOnMainThread(); tracing_sampler_profiler->OnMessageLoopStarted(); #if defined(OS_ANDROID) diff --git a/chromium/content/gpu/gpu_sandbox_hook_linux.cc b/chromium/content/gpu/gpu_sandbox_hook_linux.cc index f154e84b731..6f4ef48f905 100644 --- a/chromium/content/gpu/gpu_sandbox_hook_linux.cc +++ b/chromium/content/gpu/gpu_sandbox_hook_linux.cc @@ -122,6 +122,10 @@ void AddV4L2GpuWhitelist( // Device node for V4L2 JPEG decode accelerator drivers. static const char kDevJpegDecPath[] = "/dev/jpeg-dec"; permissions->push_back(BrokerFilePermission::ReadWrite(kDevJpegDecPath)); + + // Device node for V4L2 JPEG encode accelerator drivers. + static const char kDevJpegEncPath[] = "/dev/jpeg-enc"; + permissions->push_back(BrokerFilePermission::ReadWrite(kDevJpegEncPath)); } void AddArmMaliGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { @@ -135,6 +139,13 @@ void AddArmMaliGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { permissions->push_back(BrokerFilePermission::ReadWrite(kDevImageProc0Path)); } +void AddImgPvrGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { + // Device node needed by the IMG GPU userspace. + static const char kPvrSyncPath[] = "/dev/pvr_sync"; + + permissions->push_back(BrokerFilePermission::ReadWrite(kPvrSyncPath)); +} + void AddAmdGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { static const char* const kReadOnlyList[] = {"/etc/ld.so.cache", "/usr/lib64/libEGL.so.1", @@ -243,6 +254,7 @@ std::vector<BrokerFilePermission> FilePermissionsForGpu( if (UseV4L2Codec()) AddV4L2GpuWhitelist(&permissions, options); if (IsArchitectureArm()) { + AddImgPvrGpuWhitelist(&permissions); AddArmGpuWhitelist(&permissions); return permissions; } diff --git a/chromium/content/gpu/gpu_service_factory.cc b/chromium/content/gpu/gpu_service_factory.cc index c1b474f5914..56d9a6b37c5 100644 --- a/chromium/content/gpu/gpu_service_factory.cc +++ b/chromium/content/gpu/gpu_service_factory.cc @@ -14,6 +14,7 @@ #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) #include "base/bind.h" +#include "media/mojo/interfaces/constants.mojom.h" // nogncheck #include "media/mojo/services/media_service_factory.h" // nogncheck #if BUILDFLAG(ENABLE_LIBRARY_CDMS) #include "content/public/gpu/content_gpu_client.h" @@ -40,39 +41,57 @@ GpuServiceFactory::GpuServiceFactory( GpuServiceFactory::~GpuServiceFactory() {} -void GpuServiceFactory::RegisterServices(ServiceMap* services) { +bool GpuServiceFactory::HandleServiceRequest( + const std::string& service_name, + service_manager::mojom::ServiceRequest request) { #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) - media::CdmProxyFactoryCB cdm_proxy_factory_cb; + if (service_name == media::mojom::kMediaServiceName) { + media::CdmProxyFactoryCB cdm_proxy_factory_cb; #if BUILDFLAG(ENABLE_LIBRARY_CDMS) - cdm_proxy_factory_cb = - base::BindRepeating(&ContentGpuClient::CreateCdmProxy, - base::Unretained(GetContentClient()->gpu())); + cdm_proxy_factory_cb = + base::BindRepeating(&ContentGpuClient::CreateCdmProxy, + base::Unretained(GetContentClient()->gpu())); #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) - service_manager::EmbeddedServiceInfo info; - info.factory = base::BindRepeating( - &media::CreateGpuMediaService, gpu_preferences_, gpu_workarounds_, - gpu_feature_info_, task_runner_, media_gpu_channel_manager_, - android_overlay_factory_cb_, std::move(cdm_proxy_factory_cb)); - // 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". + // 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". + scoped_refptr<base::SingleThreadTaskRunner> task_runner; #if defined(OS_WIN) - // Run everything on the gpu main thread, since that's where the CDM runs. - info.task_runner = task_runner_; + // Run everything on the gpu main thread, since that's where the CDM runs. + 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}); + // TODO(crbug.com/786169): Check whether this needs to be single threaded. + task_runner = base::CreateSingleThreadTaskRunnerWithTraits( + {base::TaskPriority::USER_BLOCKING}); #endif // defined(OS_WIN) - services->insert(std::make_pair("media", info)); + + using FactoryCallback = + base::OnceCallback<std::unique_ptr<service_manager::Service>()>; + FactoryCallback factory = base::BindOnce( + &media::CreateGpuMediaService, std::move(request), gpu_preferences_, + gpu_workarounds_, gpu_feature_info_, task_runner_, + media_gpu_channel_manager_, android_overlay_factory_cb_, + std::move(cdm_proxy_factory_cb)); + task_runner->PostTask( + FROM_HERE, base::BindOnce( + [](FactoryCallback factory) { + service_manager::Service::RunAsyncUntilTermination( + std::move(factory).Run()); + }, + std::move(factory))); + return true; + } #endif // BUILDFLAG(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) - service_manager::EmbeddedServiceInfo shape_detection_info; - shape_detection_info.factory = - base::Bind(&shape_detection::ShapeDetectionService::Create); - services->insert(std::make_pair(shape_detection::mojom::kServiceName, - shape_detection_info)); + if (service_name == shape_detection::mojom::kServiceName) { + service_manager::Service::RunAsyncUntilTermination( + std::make_unique<shape_detection::ShapeDetectionService>( + std::move(request))); + return true; + } + + return true; } } // namespace content diff --git a/chromium/content/gpu/gpu_service_factory.h b/chromium/content/gpu/gpu_service_factory.h index a639f340b43..0c88974a386 100644 --- a/chromium/content/gpu/gpu_service_factory.h +++ b/chromium/content/gpu/gpu_service_factory.h @@ -34,7 +34,9 @@ class GpuServiceFactory : public ServiceFactory { ~GpuServiceFactory() override; // ServiceFactory overrides: - void RegisterServices(ServiceMap* services) override; + bool HandleServiceRequest( + const std::string& service_name, + service_manager::mojom::ServiceRequest request) override; private: #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |