diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-09 14:22:11 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-05-09 15:11:45 +0000 |
commit | 2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c (patch) | |
tree | e75f511546c5fd1a173e87c1f9fb11d7ac8d1af3 /chromium/content/gpu | |
parent | a4f3d46271c57e8155ba912df46a05559d14726e (diff) | |
download | qtwebengine-chromium-2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c.tar.gz |
BASELINE: Update Chromium to 51.0.2704.41
Also adds in all smaller components by reversing logic for exclusion.
Change-Id: Ibf90b506e7da088ea2f65dcf23f2b0992c504422
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'chromium/content/gpu')
-rw-r--r-- | chromium/content/gpu/BUILD.gn | 36 | ||||
-rw-r--r-- | chromium/content/gpu/DEPS | 2 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_child_thread.cc | 249 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_child_thread.h | 105 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_main.cc | 45 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_process.cc | 4 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_process.h | 2 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_process_control_impl.cc | 24 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_process_control_impl.h | 2 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_watchdog_thread.cc | 55 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_watchdog_thread.h | 25 | ||||
-rw-r--r-- | chromium/content/gpu/in_process_gpu_thread.cc | 28 | ||||
-rw-r--r-- | chromium/content/gpu/in_process_gpu_thread.h | 13 |
13 files changed, 482 insertions, 108 deletions
diff --git a/chromium/content/gpu/BUILD.gn b/chromium/content/gpu/BUILD.gn index 91600f1db7d..25bd889210c 100644 --- a/chromium/content/gpu/BUILD.gn +++ b/chromium/content/gpu/BUILD.gn @@ -3,12 +3,11 @@ # found in the LICENSE file. import("//build/config/ui.gni") -import("//content/content.gni") import("//media/media_options.gni") # See //content/BUILD.gn for how this works. group("gpu") { - visibility = [ "//content/*" ] + visibility = [ "//content/*" ] # This is an internal content API. if (is_component_build) { public_deps = [ @@ -22,6 +21,8 @@ group("gpu") { } source_set("gpu_sources") { + # This is an internal content API. Code outside of the content "component" + # (like content/test and content/shell) should depend on ":gpu" above. visibility = [ "//content/*" ] sources = [ @@ -42,19 +43,29 @@ source_set("gpu_sources") { deps = [ "//base", + "//base/third_party/dynamic_annotations", + "//components/tracing", "//content:export", + "//content/common", "//content/public/child:child_sources", + "//content/public/common:common_sources", + "//gpu:gpu", + "//gpu/ipc/common:command_buffer_traits", + "//gpu/ipc/service", + "//ipc", + "//media/mojo/services:application_factory", "//mojo/shell/public/interfaces", "//skia", + "//ui/events/ipc", + "//ui/gfx/ipc", "//ui/gl", ] - public_deps = [ - "//content/common:mojo_bindings", - ] - - if (enable_mojo_media == "gpu") { - deps += [ "//media/mojo/services:application" ] + if (mojo_media_host == "gpu") { + deps += [ "//media/mojo/services:application_factory" ] + if (is_android) { + deps += [ "//media/base/android" ] + } } if (is_win) { @@ -64,6 +75,7 @@ source_set("gpu_sources") { ] libs = [ "setupapi.lib" ] deps += [ + "//sandbox", "//third_party/angle:libEGL", "//third_party/angle:libGLESv2", ] @@ -76,4 +88,12 @@ source_set("gpu_sources") { if (use_x11) { deps += [ "//ui/events/platform/x11" ] } + + if (use_ozone) { + deps += [ "//ui/ozone" ] + } + + if (enable_vulkan) { + deps += [ "//gpu/vulkan" ] + } } diff --git a/chromium/content/gpu/DEPS b/chromium/content/gpu/DEPS index f9f4c04e64a..aaf089a7ec6 100644 --- a/chromium/content/gpu/DEPS +++ b/chromium/content/gpu/DEPS @@ -1,8 +1,10 @@ include_rules = [ "+components/tracing", "+content/child", + "+content/public/gpu", "+libEGL", "+libGLESv2", + "+media/base/android", "+media/mojo/services", "+mojo/shell", "+sandbox", diff --git a/chromium/content/gpu/gpu_child_thread.cc b/chromium/content/gpu/gpu_child_thread.cc index b9f7bc5442a..e652ca914b2 100644 --- a/chromium/content/gpu/gpu_child_thread.cc +++ b/chromium/content/gpu/gpu_child_thread.cc @@ -9,30 +9,51 @@ #include "base/bind.h" #include "base/lazy_instance.h" +#include "base/strings/string_number_conversions.h" +#include "base/threading/thread_local.h" #include "base/threading/worker_pool.h" #include "build/build_config.h" #include "content/child/child_process.h" #include "content/child/thread_safe_sender.h" -#include "content/common/gpu/gpu_memory_buffer_factory.h" -#include "content/common/gpu/gpu_messages.h" +#include "content/common/establish_channel_params.h" +#include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" +#include "content/common/gpu/media/gpu_video_decode_accelerator.h" +#include "content/common/gpu/media/gpu_video_encode_accelerator.h" +#include "content/common/gpu/media/media_service.h" +#include "content/common/gpu_host_messages.h" #include "content/gpu/gpu_process_control_impl.h" #include "content/gpu/gpu_watchdog_thread.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" +#include "content/public/gpu/content_gpu_client.h" +#include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/config/gpu_info_collector.h" +#include "gpu/config/gpu_switches.h" +#include "gpu/config/gpu_util.h" +#include "gpu/ipc/common/memory_stats.h" +#include "gpu/ipc/service/gpu_memory_buffer_factory.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_sync_message_filter.h" #include "ui/gl/gl_implementation.h" +#include "ui/gl/gl_switches.h" #include "ui/gl/gpu_switching_manager.h" +#include "url/gurl.h" #if defined(USE_OZONE) #include "ui/ozone/public/gpu_platform_support.h" #include "ui/ozone/public/ozone_platform.h" #endif +#if defined(ENABLE_VULKAN) +#include "gpu/vulkan/vulkan_surface.h" +#endif + namespace content { namespace { +base::LazyInstance<base::ThreadLocalPointer<GpuChildThread>> g_lazy_tls = + LAZY_INSTANCE_INITIALIZER; + static base::LazyInstance<scoped_refptr<ThreadSafeSender> > g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; @@ -43,19 +64,19 @@ bool GpuProcessLogMessageHandler(int severity, std::string header = str.substr(0, message_start); std::string message = str.substr(message_start); - g_thread_safe_sender.Get()->Send(new GpuHostMsg_OnLogMessage( - severity, header, message)); + g_thread_safe_sender.Get()->Send( + new GpuHostMsg_OnLogMessage(severity, header, message)); return false; } -// Message filter used to to handle GpuMsg_CreateGpuMemoryBuffer messages on -// the IO thread. This allows the UI thread in the browser process to remain +// Message filter used to to handle GpuMsg_CreateGpuMemoryBuffer messages +// on the IO thread. This allows the UI thread in the browser process to remain // fast at all times. class GpuMemoryBufferMessageFilter : public IPC::MessageFilter { public: explicit GpuMemoryBufferMessageFilter( - GpuMemoryBufferFactory* gpu_memory_buffer_factory) + gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) : gpu_memory_buffer_factory_(gpu_memory_buffer_factory), sender_(nullptr) {} @@ -72,10 +93,10 @@ class GpuMemoryBufferMessageFilter : public IPC::MessageFilter { DCHECK(sender_); bool handled = true; IPC_BEGIN_MESSAGE_MAP(GpuMemoryBufferMessageFilter, message) - IPC_MESSAGE_HANDLER(GpuMsg_CreateGpuMemoryBuffer, OnCreateGpuMemoryBuffer) - IPC_MESSAGE_HANDLER(GpuMsg_CreateGpuMemoryBufferFromHandle, - OnCreateGpuMemoryBufferFromHandle) - IPC_MESSAGE_UNHANDLED(handled = false) + IPC_MESSAGE_HANDLER(GpuMsg_CreateGpuMemoryBuffer, OnCreateGpuMemoryBuffer) + IPC_MESSAGE_HANDLER(GpuMsg_CreateGpuMemoryBufferFromHandle, + OnCreateGpuMemoryBufferFromHandle) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; } @@ -107,12 +128,12 @@ class GpuMemoryBufferMessageFilter : public IPC::MessageFilter { params.client_id))); } - GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; + gpu::GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; IPC::Sender* sender_; }; ChildThreadImpl::Options GetOptions( - GpuMemoryBufferFactory* gpu_memory_buffer_factory) { + gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) { ChildThreadImpl::Options::Builder builder; builder.AddStartupFilter( @@ -131,12 +152,17 @@ ChildThreadImpl::Options GetOptions( } // namespace +// static +GpuChildThread* GpuChildThread::current() { + return g_lazy_tls.Pointer()->Get(); +} + GpuChildThread::GpuChildThread( GpuWatchdogThread* watchdog_thread, bool dead_on_arrival, const gpu::GPUInfo& gpu_info, const DeferredMessages& deferred_messages, - GpuMemoryBufferFactory* gpu_memory_buffer_factory, + gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, gpu::SyncPointManager* sync_point_manager) : ChildThreadImpl(GetOptions(gpu_memory_buffer_factory)), dead_on_arrival_(dead_on_arrival), @@ -150,17 +176,20 @@ GpuChildThread::GpuChildThread( target_services_ = NULL; #endif g_thread_safe_sender.Get() = thread_safe_sender(); + g_lazy_tls.Pointer()->Set(this); } GpuChildThread::GpuChildThread( + const gpu::GpuPreferences& gpu_preferences, const InProcessChildThreadParams& params, - GpuMemoryBufferFactory* gpu_memory_buffer_factory, + gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, gpu::SyncPointManager* sync_point_manager) : ChildThreadImpl(ChildThreadImpl::Options::Builder() .InBrowserProcess(params) .AddStartupFilter(new GpuMemoryBufferMessageFilter( gpu_memory_buffer_factory)) .Build()), + gpu_preferences_(gpu_preferences), dead_on_arrival_(false), sync_point_manager_(sync_point_manager), in_browser_process_(true), @@ -173,10 +202,16 @@ GpuChildThread::GpuChildThread( base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kInProcessGPU)); +#if defined(ENABLE_VULKAN) + // Temporary Vulkan initialization injection. + gpu::VulkanSurface::InitializeOneOff(); +#endif + if (!gfx::GLSurface::InitializeOneOff()) VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; g_thread_safe_sender.Get() = thread_safe_sender(); + g_lazy_tls.Pointer()->Set(this); } GpuChildThread::~GpuChildThread() { @@ -184,6 +219,7 @@ GpuChildThread::~GpuChildThread() { delete deferred_messages_.front(); deferred_messages_.pop(); } + g_lazy_tls.Pointer()->Set(nullptr); } void GpuChildThread::Shutdown() { @@ -199,6 +235,9 @@ void GpuChildThread::Init(const base::Time& process_start_time) { // will be destroyed before GpuChildThread is destructed. service_registry()->AddService(base::Bind( &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); + + if (GetContentClient()->gpu()) // NULL in tests. + GetContentClient()->gpu()->RegisterMojoServices(service_registry()); } bool GpuChildThread::Send(IPC::Message* msg) { @@ -242,11 +281,109 @@ bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) { if (ChildThreadImpl::OnMessageReceived(msg)) return true; - return gpu_channel_manager_.get() && - gpu_channel_manager_->OnMessageReceived(msg); + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) +#if defined(OS_MACOSX) + IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, + OnBufferPresented) +#endif + IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) + IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) + IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) + IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) + IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState) +#if defined(OS_ANDROID) + IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); +#endif + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + if (handled) + return true; + + return false; } -void GpuChildThread::OnInitialize() { +void GpuChildThread::SetActiveURL(const GURL& url) { + GetContentClient()->SetActiveURL(url); +} + +void GpuChildThread::AddSubscription(int32_t client_id, unsigned int target) { + Send(new GpuHostMsg_AddSubscription(client_id, target)); +} + +void GpuChildThread::DidCreateOffscreenContext(const GURL& active_url) { + Send(new GpuHostMsg_DidCreateOffscreenContext(active_url)); +} + +void GpuChildThread::DidDestroyChannel(int client_id) { + media_service_->RemoveChannel(client_id); + Send(new GpuHostMsg_DestroyChannel(client_id)); +} + +void GpuChildThread::DidDestroyOffscreenContext(const GURL& active_url) { + Send(new GpuHostMsg_DidDestroyOffscreenContext(active_url)); +} + +void GpuChildThread::DidLoseContext(bool offscreen, + gpu::error::ContextLostReason reason, + const GURL& active_url) { + Send(new GpuHostMsg_DidLoseContext(offscreen, reason, active_url)); +} + +void GpuChildThread::GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) { + Send(new GpuHostMsg_GpuMemoryUmaStats(params)); +} + +void GpuChildThread::RemoveSubscription(int32_t client_id, + unsigned int target) { + Send(new GpuHostMsg_RemoveSubscription(client_id, target)); +} + +#if defined(OS_MACOSX) +void GpuChildThread::SendAcceleratedSurfaceBuffersSwapped( + int32_t surface_id, + CAContextID ca_context_id, + const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, + const gfx::Size& size, + float scale_factor, + std::vector<ui::LatencyInfo> latency_info) { + AcceleratedSurfaceBuffersSwappedParams params; + params.surface_id = surface_id; + params.ca_context_id = ca_context_id; + params.io_surface = io_surface; + params.size = size; + params.scale_factor = scale_factor; + params.latency_info = std::move(latency_info); + Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); +} +#endif + +#if defined(OS_WIN) +void GpuChildThread::SendAcceleratedSurfaceCreatedChildWindow( + gpu::SurfaceHandle parent_window, + gpu::SurfaceHandle child_window) { + Send(new GpuHostMsg_AcceleratedSurfaceCreatedChildWindow(parent_window, + child_window)); +} +#endif + +void GpuChildThread::StoreShaderToDisk(int32_t client_id, + const std::string& key, + const std::string& shader) { + Send(new GpuHostMsg_CacheShader(client_id, key, shader)); +} + +void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { + gpu_preferences_ = gpu_preferences; + + gpu_info_.video_decode_accelerator_capabilities = + content::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); + gpu_info_.video_encode_accelerator_supported_profiles = + content::GpuVideoEncodeAccelerator::GetSupportedProfiles( + gpu_preferences_); + gpu_info_.jpeg_decode_accelerator_supported = + content::GpuJpegDecodeAccelerator::IsSupported(); + // Record initialization only after collecting the GPU info because that can // take a significant amount of time. gpu_info_.initialization_time = base::Time::Now() - process_start_time_; @@ -262,10 +399,6 @@ void GpuChildThread::OnInitialize() { return; } -#if defined(OS_ANDROID) - base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); -#endif - // We don't need to pipe log messages if we are running the GPU thread in // the browser process. if (!in_browser_process_) @@ -275,12 +408,14 @@ void GpuChildThread::OnInitialize() { // IPC messages before the sandbox has been enabled and all other necessary // initialization has succeeded. gpu_channel_manager_.reset( - new GpuChannelManager(channel(), watchdog_thread_.get(), + new gpu::GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), base::ThreadTaskRunnerHandle::Get().get(), ChildProcess::current()->io_task_runner(), ChildProcess::current()->GetShutDownEvent(), sync_point_manager_, gpu_memory_buffer_factory_)); + media_service_.reset(new MediaService(gpu_channel_manager_.get())); + #if defined(USE_OZONE) ui::OzonePlatform::GetInstance() ->GetGpuPlatformSupport() @@ -345,17 +480,18 @@ void GpuChildThread::OnCollectGraphicsInfo() { } void GpuChildThread::OnGetVideoMemoryUsageStats() { - GPUVideoMemoryUsageStats video_memory_usage_stats; - if (gpu_channel_manager_) + gpu::VideoMemoryUsageStats video_memory_usage_stats; + if (gpu_channel_manager_) { gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( &video_memory_usage_stats); + } Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); } void GpuChildThread::OnClean() { DVLOG(1) << "GPU: Removing all contexts"; if (gpu_channel_manager_) - gpu_channel_manager_->LoseAllContexts(); + gpu_channel_manager_->DestroyAllChannels(); } void GpuChildThread::OnCrash() { @@ -391,8 +527,67 @@ void GpuChildThread::OnGpuSwitched() { ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); } +#if defined(OS_MACOSX) +void GpuChildThread::OnBufferPresented(const BufferPresentedParams& params) { + if (gpu_channel_manager_) { + gpu_channel_manager_->BufferPresented( + params.surface_id, params.vsync_timebase, params.vsync_interval); + } +} +#endif + +void GpuChildThread::OnEstablishChannel(const EstablishChannelParams& params) { + if (!gpu_channel_manager_) + return; + + IPC::ChannelHandle channel_handle = gpu_channel_manager_->EstablishChannel( + params.client_id, params.client_tracing_id, params.preempts, + params.allow_view_command_buffers, params.allow_real_time_streams); + media_service_->AddChannel(params.client_id); + Send(new GpuHostMsg_ChannelEstablished(channel_handle)); +} + +void GpuChildThread::OnCloseChannel(int32_t client_id) { + if (gpu_channel_manager_) + gpu_channel_manager_->RemoveChannel(client_id); +} + +void GpuChildThread::OnLoadedShader(const std::string& shader) { + if (gpu_channel_manager_) + gpu_channel_manager_->PopulateShaderCache(shader); +} + +void GpuChildThread::OnDestroyGpuMemoryBuffer( + gfx::GpuMemoryBufferId id, + int client_id, + const gpu::SyncToken& sync_token) { + if (gpu_channel_manager_) + gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token); +} + +void GpuChildThread::OnUpdateValueState(int client_id, + unsigned int target, + const gpu::ValueState& state) { + if (gpu_channel_manager_) + gpu_channel_manager_->UpdateValueState(client_id, target, state); +} + +#if defined(OS_ANDROID) +void GpuChildThread::OnWakeUpGpu() { + if (gpu_channel_manager_) + gpu_channel_manager_->WakeUpGpu(); +} +#endif + +void GpuChildThread::OnLoseAllContexts() { + if (gpu_channel_manager_) { + gpu_channel_manager_->DestroyAllChannels(); + media_service_->DestroyAllChannels(); + } +} + void GpuChildThread::BindProcessControlRequest( - mojo::InterfaceRequest<ProcessControl> request) { + mojo::InterfaceRequest<mojom::ProcessControl> request) { DVLOG(1) << "GPU: Binding ProcessControl request"; DCHECK(process_control_); process_control_bindings_.AddBinding(process_control_.get(), diff --git a/chromium/content/gpu/gpu_child_thread.h b/chromium/content/gpu/gpu_child_thread.h index 816410d5774..ccc7ac9843e 100644 --- a/chromium/content/gpu/gpu_child_thread.h +++ b/chromium/content/gpu/gpu_child_thread.h @@ -17,17 +17,20 @@ #include "base/time/time.h" #include "build/build_config.h" #include "content/child/child_thread_impl.h" -#include "content/common/gpu/gpu_channel.h" -#include "content/common/gpu/gpu_channel_manager.h" -#include "content/common/gpu/gpu_config.h" -#include "content/common/gpu/x_util.h" #include "content/common/process_control.mojom.h" +#include "gpu/command_buffer/service/gpu_preferences.h" #include "gpu/config/gpu_info.h" -#include "mojo/common/weak_binding_set.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" +#include "gpu/ipc/service/gpu_config.h" +#include "gpu/ipc/service/x_util.h" +#include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "ui/gfx/native_widget_types.h" namespace gpu { +class GpuMemoryBufferFactory; class SyncPointManager; } @@ -36,27 +39,37 @@ class TargetServices; } namespace content { -class GpuMemoryBufferFactory; class GpuProcessControlImpl; class GpuWatchdogThread; +class MediaService; +struct EstablishChannelParams; +#if defined(OS_MACOSX) +struct BufferPresentedParams; +#endif // The main thread of the GPU child process. There will only ever be one of // these per process. It does process initialization and shutdown. It forwards -// IPC messages to GpuChannelManager, which is responsible for issuing rendering -// commands to the GPU. -class GpuChildThread : public ChildThreadImpl { +// IPC messages to gpu::GpuChannelManager, which is responsible for issuing +// rendering commands to the GPU. +class GpuChildThread : public ChildThreadImpl, + public gpu::GpuChannelManagerDelegate { public: typedef std::queue<IPC::Message*> DeferredMessages; + // Returns the one gpu thread for this process. Note that this can only + // be accessed when running on the gpu thread itself. + static GpuChildThread* current(); + GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread, bool dead_on_arrival, const gpu::GPUInfo& gpu_info, const DeferredMessages& deferred_messages, - GpuMemoryBufferFactory* gpu_memory_buffer_factory, + gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, gpu::SyncPointManager* sync_point_manager); - GpuChildThread(const InProcessChildThreadParams& params, - GpuMemoryBufferFactory* gpu_memory_buffer_factory, + GpuChildThread(const gpu::GpuPreferences& gpu_preferences, + const InProcessChildThreadParams& params, + gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, gpu::SyncPointManager* sync_point_manager); ~GpuChildThread() override; @@ -66,14 +79,45 @@ class GpuChildThread : public ChildThreadImpl { void Init(const base::Time& process_start_time); void StopWatchdog(); + gpu::GpuPreferences gpu_preferences() { return gpu_preferences_; } + + private: // ChildThread overrides. bool Send(IPC::Message* msg) override; bool OnControlMessageReceived(const IPC::Message& msg) override; bool OnMessageReceived(const IPC::Message& msg) override; - private: + // gpu::GpuChannelManagerDelegate implementation. + void SetActiveURL(const GURL& url) override; + void AddSubscription(int32_t client_id, unsigned int target) override; + void DidCreateOffscreenContext(const GURL& active_url) override; + void DidDestroyChannel(int client_id) override; + void DidDestroyOffscreenContext(const GURL& active_url) override; + void DidLoseContext(bool offscreen, + gpu::error::ContextLostReason reason, + const GURL& active_url) override; + void GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) override; + void RemoveSubscription(int32_t client_id, unsigned int target) override; +#if defined(OS_MACOSX) + void SendAcceleratedSurfaceBuffersSwapped( + int32_t surface_id, + CAContextID ca_context_id, + const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, + const gfx::Size& size, + float scale_factor, + std::vector<ui::LatencyInfo> latency_info) override; +#endif +#if defined(OS_WIN) + void SendAcceleratedSurfaceCreatedChildWindow( + gpu::SurfaceHandle parent_window, + gpu::SurfaceHandle child_window) override; +#endif + void StoreShaderToDisk(int32_t client_id, + const std::string& key, + const std::string& shader) override; + // Message handlers. - void OnInitialize(); + void OnInitialize(const gpu::GpuPreferences& gpu_preferences); void OnFinalize(); void OnCollectGraphicsInfo(); void OnGetVideoMemoryUsageStats(); @@ -85,8 +129,27 @@ class GpuChildThread : public ChildThreadImpl { void OnDisableWatchdog(); void OnGpuSwitched(); +#if defined(OS_MACOSX) + void OnBufferPresented(const BufferPresentedParams& params); +#endif + void OnEstablishChannel(const EstablishChannelParams& params); + void OnCloseChannel(int32_t client_id); + void OnLoadedShader(const std::string& shader); + void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, + int client_id, + const gpu::SyncToken& sync_token); + void OnUpdateValueState(int client_id, + unsigned int target, + const gpu::ValueState& state); +#if defined(OS_ANDROID) + void OnWakeUpGpu(); +#endif + void OnLoseAllContexts(); + void BindProcessControlRequest( - mojo::InterfaceRequest<ProcessControl> request); + mojo::InterfaceRequest<mojom::ProcessControl> request); + + gpu::GpuPreferences gpu_preferences_; // Set this flag to true if a fatal error occurred before we receive the // OnInitialize message, in which case we just declare ourselves DOA. @@ -102,7 +165,9 @@ class GpuChildThread : public ChildThreadImpl { // Non-owning. gpu::SyncPointManager* sync_point_manager_; - scoped_ptr<GpuChannelManager> gpu_channel_manager_; + scoped_ptr<gpu::GpuChannelManager> gpu_channel_manager_; + + scoped_ptr<MediaService> media_service_; // Information about the GPU, such as device and vendor ID. gpu::GPUInfo gpu_info_; @@ -113,14 +178,14 @@ class GpuChildThread : public ChildThreadImpl { // Whether the GPU thread is running in the browser process. bool in_browser_process_; - // The GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. - GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; + // The gpu::GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. + gpu::GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; // Process control for Mojo application hosting. scoped_ptr<GpuProcessControlImpl> process_control_; - // Bindings to the ProcessControl impl. - mojo::WeakBindingSet<ProcessControl> process_control_bindings_; + // Bindings to the mojom::ProcessControl impl. + mojo::BindingSet<mojom::ProcessControl> process_control_bindings_; DISALLOW_COPY_AND_ASSIGN(GpuChildThread); }; diff --git a/chromium/content/gpu/gpu_main.cc b/chromium/content/gpu/gpu_main.cc index 6ab395480e8..a8c68d4d0d2 100644 --- a/chromium/content/gpu/gpu_main.cc +++ b/chromium/content/gpu/gpu_main.cc @@ -20,12 +20,7 @@ #include "build/build_config.h" #include "content/child/child_process.h" #include "content/common/content_constants_internal.h" -#include "content/common/gpu/gpu_config.h" -#include "content/common/gpu/gpu_memory_buffer_factory.h" -#include "content/common/gpu/gpu_messages.h" -#include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" -#include "content/common/gpu/media/gpu_video_decode_accelerator.h" -#include "content/common/gpu/media/gpu_video_encode_accelerator.h" +#include "content/common/gpu_host_messages.h" #include "content/common/sandbox_linux/sandbox_linux.h" #include "content/gpu/gpu_child_thread.h" #include "content/gpu/gpu_process.h" @@ -38,6 +33,9 @@ #include "gpu/config/gpu_info_collector.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/service/gpu_config.h" +#include "gpu/ipc/service/gpu_memory_buffer_factory.h" #include "ui/events/platform/platform_event_source.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_implementation.h" @@ -64,7 +62,7 @@ #if defined(USE_X11) #include "ui/base/x/x11_util.h" -#include "ui/gfx/x/x11_switches.h" +#include "ui/gfx/x/x11_switches.h" // nogncheck #endif #if defined(OS_LINUX) @@ -121,8 +119,8 @@ bool GpuProcessLogMessageHandler(int severity, const std::string& str) { std::string header = str.substr(0, message_start); std::string message = str.substr(message_start); - deferred_messages.Get().push(new GpuHostMsg_OnLogMessage( - severity, header, message)); + deferred_messages.Get().push( + new GpuHostMsg_OnLogMessage(severity, header, message)); return false; } @@ -251,6 +249,11 @@ int GpuMain(const MainFunctionParams& parameters) { VaapiWrapper::PreSandboxInitialization(); #endif +#if defined(OS_ANDROID) || defined(OS_CHROMEOS) + // Set thread priority before sandbox initialization. + base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); +#endif + // Warm up resources that don't need access to GPUInfo. if (WarmUpSandbox(command_line)) { #if defined(OS_LINUX) @@ -309,6 +312,10 @@ int GpuMain(const MainFunctionParams& parameters) { // (Chrome OS, Android) or where workarounds may be dependent on GL_VENDOR // and GL_RENDERER strings which are lazily computed (Linux). if (!command_line.HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { + // TODO: this can not affect disabled extensions, since they're already + // initialized in the bindings. This should be moved before bindings + // initialization. However, populating GPUInfo fully works only on + // Android. Other platforms would need the bindings to query GL strings. gpu::ApplyGpuDriverBugWorkarounds( gpu_info, const_cast<base::CommandLine*>(&command_line)); } @@ -366,26 +373,24 @@ int GpuMain(const MainFunctionParams& parameters) { #elif defined(OS_MACOSX) gpu_info.sandboxed = Sandbox::SandboxIsCurrentlyActive(); #endif - - gpu_info.video_decode_accelerator_capabilities = - content::GpuVideoDecodeAccelerator::GetCapabilities(); - gpu_info.video_encode_accelerator_supported_profiles = - content::GpuVideoEncodeAccelerator::GetSupportedProfiles(); - gpu_info.jpeg_decode_accelerator_supported = - content::GpuJpegDecodeAccelerator::IsSupported(); } else { dead_on_arrival = true; } logging::SetLogMessageHandler(NULL); - scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory; - if (GpuMemoryBufferFactory::GetNativeType() != gfx::EMPTY_BUFFER) - gpu_memory_buffer_factory = GpuMemoryBufferFactory::CreateNativeType(); + scoped_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory; + if (gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) + gpu_memory_buffer_factory = gpu::GpuMemoryBufferFactory::CreateNativeType(); gpu::SyncPointManager sync_point_manager(false); - GpuProcess gpu_process; + base::ThreadPriority io_thread_priority = base::ThreadPriority::NORMAL; +#if defined(OS_ANDROID) || defined(OS_CHROMEOS) + io_thread_priority = base::ThreadPriority::DISPLAY; +#endif + + GpuProcess gpu_process(io_thread_priority); GpuChildThread* child_thread = new GpuChildThread( watchdog_thread.get(), dead_on_arrival, gpu_info, deferred_messages.Get(), diff --git a/chromium/content/gpu/gpu_process.cc b/chromium/content/gpu/gpu_process.cc index 23906943d18..2523fd331ed 100644 --- a/chromium/content/gpu/gpu_process.cc +++ b/chromium/content/gpu/gpu_process.cc @@ -6,8 +6,8 @@ namespace content { -GpuProcess::GpuProcess() { -} +GpuProcess::GpuProcess(base::ThreadPriority io_thread_priority) + : ChildProcess(io_thread_priority) {} GpuProcess::~GpuProcess() { } diff --git a/chromium/content/gpu/gpu_process.h b/chromium/content/gpu/gpu_process.h index 14754e90e5a..dbcf57759ee 100644 --- a/chromium/content/gpu/gpu_process.h +++ b/chromium/content/gpu/gpu_process.h @@ -12,7 +12,7 @@ namespace content { class GpuProcess : public ChildProcess { public: - GpuProcess(); + explicit GpuProcess(base::ThreadPriority io_thread_priority); ~GpuProcess() override; private: diff --git a/chromium/content/gpu/gpu_process_control_impl.cc b/chromium/content/gpu/gpu_process_control_impl.cc index cb3175b8bfc..f0b2489d175 100644 --- a/chromium/content/gpu/gpu_process_control_impl.cc +++ b/chromium/content/gpu/gpu_process_control_impl.cc @@ -7,8 +7,12 @@ #if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) #include "base/bind.h" #include "base/bind_helpers.h" -#include "media/mojo/services/mojo_media_application.h" -#include "mojo/shell/static_application_loader.h" +#include "content/common/mojo/static_loader.h" +#include "content/public/common/content_client.h" +#include "media/mojo/services/mojo_media_application_factory.h" +#if defined(OS_ANDROID) +#include "media/base/android/media_client_android.h" +#endif #endif namespace content { @@ -17,13 +21,17 @@ GpuProcessControlImpl::GpuProcessControlImpl() {} GpuProcessControlImpl::~GpuProcessControlImpl() {} -void GpuProcessControlImpl::RegisterApplicationLoaders( - URLToLoaderMap* url_to_loader_map) { +void GpuProcessControlImpl::RegisterLoaders( + NameToLoaderMap* name_to_loader_map) { #if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) - (*url_to_loader_map)[GURL("mojo:media")] = - new mojo::shell::StaticApplicationLoader( - base::Bind(&media::MojoMediaApplication::CreateApp), - base::Bind(&base::DoNothing)); +#if defined(OS_ANDROID) + // Only set once per process instance. + media::SetMediaClientAndroid(GetContentClient()->GetMediaClientAndroid()); +#endif + + (*name_to_loader_map)["mojo:media"] = new StaticLoader( + base::Bind(&media::CreateMojoMediaApplication), + base::Bind(&base::DoNothing)); #endif } diff --git a/chromium/content/gpu/gpu_process_control_impl.h b/chromium/content/gpu/gpu_process_control_impl.h index 4353096a6fc..b886bb5fcfc 100644 --- a/chromium/content/gpu/gpu_process_control_impl.h +++ b/chromium/content/gpu/gpu_process_control_impl.h @@ -17,7 +17,7 @@ class GpuProcessControlImpl : public ProcessControlImpl { ~GpuProcessControlImpl() override; // ProcessControlImpl: - void RegisterApplicationLoaders(URLToLoaderMap* url_to_loader_map) override; + void RegisterLoaders(NameToLoaderMap* name_to_loader_map) override; private: DISALLOW_COPY_AND_ASSIGN(GpuProcessControlImpl); diff --git a/chromium/content/gpu/gpu_watchdog_thread.cc b/chromium/content/gpu/gpu_watchdog_thread.cc index 4cfde4f94b5..4ffec06ee57 100644 --- a/chromium/content/gpu/gpu_watchdog_thread.cc +++ b/chromium/content/gpu/gpu_watchdog_thread.cc @@ -11,6 +11,7 @@ #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/compiler_specific.h" +#include "base/debug/alias.h" #include "base/files/file_util.h" #include "base/location.h" #include "base/macros.h" @@ -42,6 +43,8 @@ GpuWatchdogThread::GpuWatchdogThread(int timeout) timeout_(base::TimeDelta::FromMilliseconds(timeout)), armed_(false), task_observer_(this), + use_thread_cpu_time_(true), + responsive_acknowledge_count_(0), #if defined(OS_WIN) watched_thread_handle_(0), arm_cpu_time_(), @@ -159,12 +162,30 @@ void GpuWatchdogThread::OnAcknowledge() { weak_factory_.InvalidateWeakPtrs(); armed_ = false; - if (suspended_) + if (suspended_) { + responsive_acknowledge_count_ = 0; return; + } + + base::Time current_time = base::Time::Now(); + + // The watchdog waits until at least 6 consecutive checks have returned in + // less than 50 ms before it will start ignoring the CPU time in determining + // whether to timeout. This is a compromise to allow startups that are slow + // due to disk contention to avoid timing out, but once the GPU process is + // running smoothly the watchdog will be able to detect hangs that don't use + // the CPU. + if ((current_time - check_time_) < base::TimeDelta::FromMilliseconds(50)) + responsive_acknowledge_count_++; + else + responsive_acknowledge_count_ = 0; + + if (responsive_acknowledge_count_ >= 6) + use_thread_cpu_time_ = false; // If it took a long time for the acknowledgement, assume the computer was // recently suspended. - bool was_suspended = (base::Time::Now() > suspension_timeout_); + bool was_suspended = (current_time > suspension_timeout_); // The monitored thread has responded. Post a task to check it again. task_runner()->PostDelayedTask( @@ -188,12 +209,16 @@ void GpuWatchdogThread::OnCheck(bool after_suspend) { #if defined(OS_WIN) arm_cpu_time_ = GetWatchedThreadTime(); + + QueryUnbiasedInterruptTime(&arm_interrupt_time_); #endif + check_time_ = base::Time::Now(); + check_timeticks_ = base::TimeTicks::Now(); // Immediately after the computer is woken up from being suspended it might // be pretty sluggish, so allow some extra time before the next timeout. base::TimeDelta timeout = timeout_ * (after_suspend ? 3 : 1); - suspension_timeout_ = base::Time::Now() + timeout * 2; + suspension_timeout_ = check_time_ + timeout * 2; // Post a task to the monitored thread that does nothing but wake up the // TaskObserver. Any other tasks that are pending on the watched thread will @@ -219,7 +244,7 @@ void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() { // Defer termination until a certain amount of CPU time has elapsed on the // watched thread. base::TimeDelta time_since_arm = GetWatchedThreadTime() - arm_cpu_time_; - if (time_since_arm < timeout_) { + if (use_thread_cpu_time_ && (time_since_arm < timeout_)) { message_loop()->PostDelayedTask( FROM_HERE, base::Bind( @@ -312,6 +337,28 @@ void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() { } #endif +// Store variables so they're available in crash dumps to help determine the +// cause of any hang. +#if defined(OS_WIN) + ULONGLONG fire_interrupt_time; + QueryUnbiasedInterruptTime(&fire_interrupt_time); + + // This is the time since the watchdog was armed, in 100ns intervals, + // ignoring time where the computer is suspended. + ULONGLONG interrupt_delay = fire_interrupt_time - arm_interrupt_time_; + + base::debug::Alias(&interrupt_delay); + base::debug::Alias(&time_since_arm); + + bool using_high_res_timer = base::Time::IsHighResolutionTimerInUse(); + base::debug::Alias(&using_high_res_timer); +#endif + + base::Time current_time = base::Time::Now(); + base::TimeTicks current_timeticks = base::TimeTicks::Now(); + base::debug::Alias(¤t_time); + base::debug::Alias(¤t_timeticks); + LOG(ERROR) << "The GPU process hung. Terminating after " << timeout_.InMilliseconds() << " ms."; diff --git a/chromium/content/gpu/gpu_watchdog_thread.h b/chromium/content/gpu/gpu_watchdog_thread.h index 4370d831168..fb95eeee0a2 100644 --- a/chromium/content/gpu/gpu_watchdog_thread.h +++ b/chromium/content/gpu/gpu_watchdog_thread.h @@ -13,7 +13,7 @@ #include "base/threading/thread.h" #include "base/time/time.h" #include "build/build_config.h" -#include "content/common/gpu/gpu_watchdog.h" +#include "gpu/ipc/service/gpu_watchdog.h" #include "ui/gfx/native_widget_types.h" #if defined(USE_X11) @@ -23,8 +23,7 @@ extern "C" { } #include <sys/poll.h> #include "ui/base/x/x11_util.h" -#include "ui/gfx/x/x11_types.h" - +#include "ui/gfx/x/x11_types.h" // nogncheck #endif namespace content { @@ -32,7 +31,7 @@ namespace content { // A thread that intermitently sends tasks to a group of watched message loops // and deliberately crashes if one of them does not respond after a timeout. class GpuWatchdogThread : public base::Thread, - public GpuWatchdog, + public gpu::GpuWatchdog, public base::PowerObserver, public base::RefCountedThreadSafe<GpuWatchdogThread> { public: @@ -42,7 +41,7 @@ class GpuWatchdogThread : public base::Thread, bool armed() const { return armed_; } void PostAcknowledge(); - // Implement GpuWatchdog. + // Implement gpu::GpuWatchdog. void CheckArmed() override; // Must be called after a PowerMonitor has been created. Can be called from @@ -97,9 +96,21 @@ class GpuWatchdogThread : public base::Thread, volatile bool armed_; GpuWatchdogTaskObserver task_observer_; + // True if the watchdog should wait for a certain amount of CPU to be used + // before killing the process. + bool use_thread_cpu_time_; + + // The number of consecutive acknowledgements that had a latency less than + // 50ms. + int responsive_acknowledge_count_; + #if defined(OS_WIN) void* watched_thread_handle_; base::TimeDelta arm_cpu_time_; + + // This measures the time that the system has been running, in units of 100 + // ns. + ULONGLONG arm_interrupt_time_; #endif // Time after which it's assumed that the computer has been suspended since @@ -108,6 +119,10 @@ class GpuWatchdogThread : public base::Thread, bool suspended_; + // This is the time the last check was sent. + base::Time check_time_; + base::TimeTicks check_timeticks_; + #if defined(OS_CHROMEOS) FILE* tty_file_; #endif diff --git a/chromium/content/gpu/in_process_gpu_thread.cc b/chromium/content/gpu/in_process_gpu_thread.cc index 59a4f487e59..cb1c880df29 100644 --- a/chromium/content/gpu/in_process_gpu_thread.cc +++ b/chromium/content/gpu/in_process_gpu_thread.cc @@ -6,10 +6,11 @@ #include "base/time/time.h" #include "build/build_config.h" -#include "content/common/gpu/gpu_memory_buffer_factory.h" #include "content/gpu/gpu_child_thread.h" #include "content/gpu/gpu_process.h" #include "gpu/command_buffer/service/sync_point_manager.h" +#include "gpu/ipc/common/gpu_memory_buffer_support.h" +#include "gpu/ipc/service/gpu_memory_buffer_factory.h" #if defined(OS_ANDROID) #include "base/android/jni_android.h" @@ -19,15 +20,17 @@ namespace content { InProcessGpuThread::InProcessGpuThread( const InProcessChildThreadParams& params, + const gpu::GpuPreferences& gpu_preferences, gpu::SyncPointManager* sync_point_manager_override) : base::Thread("Chrome_InProcGpuThread"), params_(params), gpu_process_(NULL), + gpu_preferences_(gpu_preferences), sync_point_manager_override_(sync_point_manager_override), gpu_memory_buffer_factory_( - GpuMemoryBufferFactory::GetNativeType() != gfx::EMPTY_BUFFER - ? GpuMemoryBufferFactory::CreateNativeType() - : nullptr) { + gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER + ? gpu::GpuMemoryBufferFactory::CreateNativeType() + : nullptr) { if (!sync_point_manager_override_) { sync_point_manager_.reset(new gpu::SyncPointManager(false)); sync_point_manager_override_ = sync_point_manager_.get(); @@ -39,20 +42,25 @@ InProcessGpuThread::~InProcessGpuThread() { } void InProcessGpuThread::Init() { + base::ThreadPriority io_thread_priority = base::ThreadPriority::NORMAL; + +#if defined(OS_ANDROID) // Call AttachCurrentThreadWithName, before any other AttachCurrentThread() // calls. The latter causes Java VM to assign Thread-??? to the thread name. // Please note calls to AttachCurrentThreadWithName after AttachCurrentThread // will not change the thread name kept in Java VM. -#if defined(OS_ANDROID) base::android::AttachCurrentThreadWithName(thread_name()); + // Up the priority of the |io_thread_| on Android. + io_thread_priority = base::ThreadPriority::DISPLAY; #endif - gpu_process_ = new GpuProcess(); + gpu_process_ = new GpuProcess(io_thread_priority); // The process object takes ownership of the thread object, so do not // save and delete the pointer. GpuChildThread* child_thread = new GpuChildThread( - params_, gpu_memory_buffer_factory_.get(), sync_point_manager_override_); + gpu_preferences_, params_, gpu_memory_buffer_factory_.get(), + sync_point_manager_override_); // Since we are in the browser process, use the thread start time as the // process start time. @@ -67,8 +75,10 @@ void InProcessGpuThread::CleanUp() { } base::Thread* CreateInProcessGpuThread( - const InProcessChildThreadParams& params) { - return new InProcessGpuThread(params, nullptr); + const InProcessChildThreadParams& params, + const gpu::GpuPreferences& gpu_preferences) { + return new InProcessGpuThread( + params, gpu_preferences, nullptr); } } // namespace content diff --git a/chromium/content/gpu/in_process_gpu_thread.h b/chromium/content/gpu/in_process_gpu_thread.h index 49eda00efaf..18871270927 100644 --- a/chromium/content/gpu/in_process_gpu_thread.h +++ b/chromium/content/gpu/in_process_gpu_thread.h @@ -6,17 +6,20 @@ #define CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ #include "base/macros.h" +#include "base/memory/scoped_ptr.h" #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" namespace gpu { +class GpuMemoryBufferFactory; class SyncPointManager; +struct GpuPreferences; } namespace content { -class GpuMemoryBufferFactory; class GpuProcess; // This class creates a GPU thread (instead of a GPU process), when running @@ -24,6 +27,7 @@ class GpuProcess; class InProcessGpuThread : public base::Thread { public: InProcessGpuThread(const InProcessChildThreadParams& params, + const gpu::GpuPreferences& gpu_preferences, gpu::SyncPointManager* sync_point_manager_override); ~InProcessGpuThread() override; @@ -37,19 +41,22 @@ class InProcessGpuThread : public base::Thread { // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. GpuProcess* gpu_process_; + const gpu::GpuPreferences gpu_preferences_; + // Can be null if overridden. scoped_ptr<gpu::SyncPointManager> sync_point_manager_; // Non-owning. gpu::SyncPointManager* sync_point_manager_override_; - scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; + scoped_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread); }; CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( - const InProcessChildThreadParams& params); + const InProcessChildThreadParams& params, + const gpu::GpuPreferences& gpu_preferences); } // namespace content |