diff options
Diffstat (limited to 'chromium/content/browser/android/synchronous_compositor_base.cc')
-rw-r--r-- | chromium/content/browser/android/synchronous_compositor_base.cc | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/chromium/content/browser/android/synchronous_compositor_base.cc b/chromium/content/browser/android/synchronous_compositor_base.cc index acc5e349f99..0d085095b91 100644 --- a/chromium/content/browser/android/synchronous_compositor_base.cc +++ b/chromium/content/browser/android/synchronous_compositor_base.cc @@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/supports_user_data.h" +#include "content/browser/android/in_process/synchronous_compositor_factory_impl.h" #include "content/browser/android/in_process/synchronous_compositor_impl.h" #include "content/browser/android/synchronous_compositor_host.h" #include "content/browser/gpu/gpu_process_host.h" @@ -20,27 +21,25 @@ class SynchronousCompositorClient; namespace { -gpu::SyncPointManager* g_sync_point_manager = nullptr; +base::LazyInstance<scoped_refptr<gpu::InProcessCommandBuffer::Service>> + g_gpu_service = LAZY_INSTANCE_INITIALIZER; base::Thread* CreateInProcessGpuThreadForSynchronousCompositor( - const InProcessChildThreadParams& params) { - DCHECK(g_sync_point_manager); - return new InProcessGpuThread(params, g_sync_point_manager); + const InProcessChildThreadParams& params, + const gpu::GpuPreferences& gpu_preferences) { + DCHECK(g_gpu_service.Get()); + return new InProcessGpuThread(params, gpu_preferences, + g_gpu_service.Get()->sync_point_manager()); } } // namespace void SynchronousCompositor::SetGpuService( scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { - DCHECK(!g_sync_point_manager); - g_sync_point_manager = service->sync_point_manager(); + DCHECK(!g_gpu_service.Get()); + g_gpu_service.Get() = service; GpuProcessHost::RegisterGpuMainThreadFactory( CreateInProcessGpuThreadForSynchronousCompositor); - - if (!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kIPCSyncCompositing)) { - SynchronousCompositorImpl::SetGpuServiceInProc(service); - } } // static @@ -65,10 +64,15 @@ scoped_ptr<SynchronousCompositorBase> SynchronousCompositorBase::Create( if (!web_contents_android->synchronous_compositor_client()) return nullptr; // Not using sync compositing. - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kIPCSyncCompositing)) { + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kIPCSyncCompositing)) { + bool async_input = + !command_line->HasSwitch(switches::kSyncInputForSyncCompositor); + bool use_in_proc_software_draw = + command_line->HasSwitch(switches::kSingleProcess); return make_scoped_ptr(new SynchronousCompositorHost( - rwhva, web_contents_android->synchronous_compositor_client())); + rwhva, web_contents_android->synchronous_compositor_client(), + async_input, use_in_proc_software_draw)); } return make_scoped_ptr(new SynchronousCompositorImpl( rwhva, web_contents_android->synchronous_compositor_client())); |