diff options
| author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-20 13:40:20 +0100 |
|---|---|---|
| committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-22 12:41:23 +0000 |
| commit | 7961cea6d1041e3e454dae6a1da660b453efd238 (patch) | |
| tree | c0eeb4a9ff9ba32986289c1653d9608e53ccb444 /chromium/content/gpu | |
| parent | b7034d0803538058e5c9d904ef03cf5eab34f6ef (diff) | |
| download | qtwebengine-chromium-7961cea6d1041e3e454dae6a1da660b453efd238.tar.gz | |
BASELINE: Update Chromium to 78.0.3904.130
Change-Id: If185e0c0061b3437531c97c9c8c78f239352a68b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/content/gpu')
| -rw-r--r-- | chromium/content/gpu/BUILD.gn | 4 | ||||
| -rw-r--r-- | chromium/content/gpu/DEPS | 2 | ||||
| -rw-r--r-- | chromium/content/gpu/OWNERS | 1 | ||||
| -rw-r--r-- | chromium/content/gpu/gpu_child_thread.cc | 17 | ||||
| -rw-r--r-- | chromium/content/gpu/gpu_child_thread.h | 3 | ||||
| -rw-r--r-- | chromium/content/gpu/gpu_main.cc | 16 | ||||
| -rw-r--r-- | chromium/content/gpu/gpu_sandbox_hook_linux.cc | 34 | ||||
| -rw-r--r-- | chromium/content/gpu/gpu_service_factory.cc | 15 |
8 files changed, 56 insertions, 36 deletions
diff --git a/chromium/content/gpu/BUILD.gn b/chromium/content/gpu/BUILD.gn index 29e78fec47c..0939d25ccd7 100644 --- a/chromium/content/gpu/BUILD.gn +++ b/chromium/content/gpu/BUILD.gn @@ -75,7 +75,7 @@ target(link_target_type, "gpu_sources") { "//components/viz/service/main", "//media/gpu/ipc/service", "//media/mojo/clients:clients", - "//media/mojo/interfaces:constants", + "//media/mojo/mojom:constants", "//services/service_manager/embedder", "//services/service_manager/public/cpp", "//services/service_manager/public/mojom", @@ -83,7 +83,7 @@ target(link_target_type, "gpu_sources") { "//services/shape_detection:lib", "//services/shape_detection/public/mojom", "//services/tracing/public/cpp", - "//services/viz/privileged/interfaces", + "//services/viz/privileged/mojom", "//skia", "//third_party/angle:angle_gpu_info_util", "//ui/gfx/ipc", diff --git a/chromium/content/gpu/DEPS b/chromium/content/gpu/DEPS index 1a5a9db31c9..ae42cef0592 100644 --- a/chromium/content/gpu/DEPS +++ b/chromium/content/gpu/DEPS @@ -8,7 +8,7 @@ include_rules = [ "+services/service_manager", "+services/shape_detection", "+services/tracing/public/cpp", - "+services/viz/privileged/interfaces", + "+services/viz/privileged/mojom", "+services/viz/service", "+sandbox", "+skia", diff --git a/chromium/content/gpu/OWNERS b/chromium/content/gpu/OWNERS index c45f8fa6e23..ae61c99483f 100644 --- a/chromium/content/gpu/OWNERS +++ b/chromium/content/gpu/OWNERS @@ -1,5 +1,4 @@ kbr@chromium.org -piman@chromium.org zmo@chromium.org # COMPONENT: Internals>GPU>Internals diff --git a/chromium/content/gpu/gpu_child_thread.cc b/chromium/content/gpu/gpu_child_thread.cc index 437d656f4cd..882c679c216 100644 --- a/chromium/content/gpu/gpu_child_thread.cc +++ b/chromium/content/gpu/gpu_child_thread.cc @@ -13,6 +13,7 @@ #include "base/callback_helpers.h" #include "base/command_line.h" #include "base/memory/weak_ptr.h" +#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/sequenced_task_runner.h" #include "base/threading/thread_checker.h" @@ -34,7 +35,9 @@ #include "media/gpu/ipc/service/media_gpu_channel_manager.h" #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 "services/shape_detection/public/mojom/shape_detection_service.mojom.h" +#include "services/shape_detection/shape_detection_service.h" +#include "services/viz/privileged/mojom/gl/gpu_service.mojom.h" #include "third_party/skia/include/core/SkGraphics.h" #if defined(USE_OZONE) @@ -170,6 +173,8 @@ viz::VizMainImpl::ExternalDependencies CreateVizMainDependencies( deps.sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager(); deps.shared_image_manager = GetContentClient()->gpu()->GetSharedImageManager(); + deps.viz_compositor_thread_runner = + GetContentClient()->gpu()->GetVizCompositorThreadRunner(); } auto* process = ChildProcess::current(); deps.shutdown_event = process->GetShutDownEvent(); @@ -286,6 +291,16 @@ void GpuChildThread::RunService( service_factory_->RunService(service_name, std::move(receiver)); } +void GpuChildThread::BindServiceInterface( + mojo::GenericPendingReceiver receiver) { + if (auto shape_detection_receiver = + receiver.As<shape_detection::mojom::ShapeDetectionService>()) { + static base::NoDestructor<shape_detection::ShapeDetectionService> service{ + std::move(shape_detection_receiver)}; + return; + } +} + void GpuChildThread::OnAssociatedInterfaceRequest( const std::string& name, mojo::ScopedInterfaceEndpointHandle handle) { diff --git a/chromium/content/gpu/gpu_child_thread.h b/chromium/content/gpu/gpu_child_thread.h index 92cc7f80119..e111ac589d4 100644 --- a/chromium/content/gpu/gpu_child_thread.h +++ b/chromium/content/gpu/gpu_child_thread.h @@ -34,7 +34,7 @@ #include "media/base/android_overlay_mojo_factory.h" #include "mojo/public/cpp/bindings/pending_associated_receiver.h" #include "services/service_manager/public/cpp/service_context_ref.h" -#include "services/viz/privileged/interfaces/viz_main.mojom.h" +#include "services/viz/privileged/mojom/viz_main.mojom.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" #include "ui/gfx/native_widget_types.h" @@ -74,6 +74,7 @@ class GpuChildThread : public ChildThreadImpl, void RunService( const std::string& service_name, mojo::PendingReceiver<service_manager::mojom::Service> receiver) override; + void BindServiceInterface(mojo::GenericPendingReceiver receiver) override; // IPC::Listener implementation via ChildThreadImpl: void OnAssociatedInterfaceRequest( diff --git a/chromium/content/gpu/gpu_main.cc b/chromium/content/gpu/gpu_main.cc index de80e1023c9..d257830f594 100644 --- a/chromium/content/gpu/gpu_main.cc +++ b/chromium/content/gpu/gpu_main.cc @@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/feature_list.h" #include "base/lazy_instance.h" +#include "base/message_loop/message_pump_type.h" #include "base/metrics/histogram_macros.h" #include "base/rand_util.h" #include "base/run_loop.h" @@ -246,14 +247,14 @@ int GpuMain(const MainFunctionParams& parameters) { if (command_line.HasSwitch(switches::kHeadless)) { main_thread_task_executor = std::make_unique<base::SingleThreadTaskExecutor>( - base::MessagePump::Type::DEFAULT); + base::MessagePumpType::DEFAULT); } else { #if defined(OS_WIN) // The GpuMain thread should not be pumping Windows messages because no UI // is expected to run on this thread. main_thread_task_executor = std::make_unique<base::SingleThreadTaskExecutor>( - base::MessagePump::Type::DEFAULT); + base::MessagePumpType::DEFAULT); #elif defined(USE_X11) // Depending on how Chrome is running there are multiple threads that can // make Xlib function calls. Call XInitThreads() here to be safe, even if @@ -267,14 +268,14 @@ int GpuMain(const MainFunctionParams& parameters) { return RESULT_CODE_GPU_DEAD_ON_ARRIVAL; main_thread_task_executor = std::make_unique<base::SingleThreadTaskExecutor>( - base::MessagePump::Type::UI); + base::MessagePumpType::UI); event_source = ui::PlatformEventSource::CreateDefault(); #elif defined(USE_OZONE) // The MessagePump type required depends on the Ozone platform selected at // runtime. main_thread_task_executor = std::make_unique<base::SingleThreadTaskExecutor>( - gpu_preferences.message_loop_type); + gpu_preferences.message_pump_type); #elif defined(OS_LINUX) #error "Unsupported Linux platform." #elif defined(OS_MACOSX) @@ -283,14 +284,14 @@ int GpuMain(const MainFunctionParams& parameters) { // https://crbug.com/312462#c51 and https://crbug.com/783298 main_thread_task_executor = std::make_unique<base::SingleThreadTaskExecutor>( - base::MessagePump::Type::NS_RUNLOOP); + base::MessagePumpType::NS_RUNLOOP); // Tell LaunchServices to continue without a connection to the daemon. _LSSetApplicationLaunchServicesServerConnectionStatus(0, nullptr); #else main_thread_task_executor = std::make_unique<base::SingleThreadTaskExecutor>( - base::MessagePump::Type::DEFAULT); + base::MessagePumpType::DEFAULT); #endif } @@ -361,7 +362,8 @@ int GpuMain(const MainFunctionParams& parameters) { gpu_process.set_main_thread(child_thread); // Setup tracing sampler profiler as early as possible. - tracing::TracingSamplerProfiler::CreateForCurrentThread(); + std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler = + tracing::TracingSamplerProfiler::CreateOnMainThread(); #if defined(OS_ANDROID) base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( diff --git a/chromium/content/gpu/gpu_sandbox_hook_linux.cc b/chromium/content/gpu/gpu_sandbox_hook_linux.cc index e3d4e137532..078b93be5e5 100644 --- a/chromium/content/gpu/gpu_sandbox_hook_linux.cc +++ b/chromium/content/gpu/gpu_sandbox_hook_linux.cc @@ -8,6 +8,7 @@ #include <errno.h> #include <memory> +#include <sstream> #include <utility> #include <vector> @@ -102,17 +103,32 @@ void AddV4L2GpuWhitelist( const service_manager::SandboxSeccompBPF::Options& options) { if (options.accelerated_video_decode_enabled) { // Device nodes for V4L2 video decode accelerator drivers. + // We do not use a FileEnumerator because the device files may not exist + // yet when the sandbox is created. But since we are restricting access + // to the video-dec* and media-dec* prefixes we know that we cannot + // authorize a non-decoder device by accident. + static constexpr size_t MAX_V4L2_DECODERS = 5; static const base::FilePath::CharType kDevicePath[] = FILE_PATH_LITERAL("/dev/"); - static const base::FilePath::CharType kVideoDecPattern[] = "video-dec[0-9]"; - base::FileEnumerator enumerator(base::FilePath(kDevicePath), false, - base::FileEnumerator::FILES, - base::FilePath(kVideoDecPattern).value()); - for (base::FilePath name = enumerator.Next(); !name.empty(); - name = enumerator.Next()) - permissions->push_back(BrokerFilePermission::ReadWrite(name.value())); + static const base::FilePath::CharType kVideoDecBase[] = "video-dec"; + static const base::FilePath::CharType kMediaDecBase[] = "media-dec"; + for (size_t i = 0; i < MAX_V4L2_DECODERS; i++) { + std::ostringstream decoderPath; + decoderPath << kDevicePath << kVideoDecBase << i; + permissions->push_back( + BrokerFilePermission::ReadWrite(decoderPath.str())); + + std::ostringstream mediaDevicePath; + mediaDevicePath << kDevicePath << kMediaDecBase << i; + permissions->push_back( + BrokerFilePermission::ReadWrite(mediaDevicePath.str())); + } } + // Image processor used on ARM platforms. + static const char kDevImageProc0Path[] = "/dev/image-proc0"; + permissions->push_back(BrokerFilePermission::ReadWrite(kDevImageProc0Path)); + if (options.accelerated_video_encode_enabled) { // Device node for V4L2 video encode accelerator drivers. static const char kDevVideoEncPath[] = "/dev/video-enc"; @@ -132,11 +148,7 @@ void AddArmMaliGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { // Device file needed by the ARM GPU userspace. static const char kMali0Path[] = "/dev/mali0"; - // Image processor used on ARM platforms. - static const char kDevImageProc0Path[] = "/dev/image-proc0"; - permissions->push_back(BrokerFilePermission::ReadWrite(kMali0Path)); - permissions->push_back(BrokerFilePermission::ReadWrite(kDevImageProc0Path)); // Non-privileged render nodes for format enumeration. // https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#render-nodes diff --git a/chromium/content/gpu/gpu_service_factory.cc b/chromium/content/gpu/gpu_service_factory.cc index 71ae3dee017..4b8a936be0b 100644 --- a/chromium/content/gpu/gpu_service_factory.cc +++ b/chromium/content/gpu/gpu_service_factory.cc @@ -9,12 +9,10 @@ #include "base/task/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" #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) #include "base/bind.h" -#include "media/mojo/interfaces/constants.mojom.h" // nogncheck +#include "media/mojo/mojom/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" @@ -63,8 +61,8 @@ void GpuServiceFactory::RunService( task_runner = task_runner_; #else // TODO(crbug.com/786169): Check whether this needs to be single threaded. - task_runner = base::CreateSingleThreadTaskRunnerWithTraits( - {base::TaskPriority::USER_BLOCKING}); + task_runner = base::CreateSingleThreadTaskRunner( + {base::ThreadPool(), base::TaskPriority::USER_BLOCKING}); #endif // defined(OS_WIN) using FactoryCallback = @@ -84,13 +82,6 @@ void GpuServiceFactory::RunService( return; } #endif // BUILDFLAG(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) - - if (service_name == shape_detection::mojom::kServiceName) { - service_manager::Service::RunAsyncUntilTermination( - std::make_unique<shape_detection::ShapeDetectionService>( - std::move(request))); - return; - } } } // namespace content |
