Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/android/synchronous_compositor_base.h" | 5 #include "content/browser/android/synchronous_compositor_base.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/supports_user_data.h" | 8 #include "base/supports_user_data.h" |
| 9 #include "content/browser/android/in_process/synchronous_compositor_factory_impl .h" | 9 #include "content/browser/android/in_process/synchronous_compositor_factory_impl .h" |
| 10 #include "content/browser/android/in_process/synchronous_compositor_impl.h" | 10 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
| 11 #include "content/browser/android/synchronous_compositor_host.h" | 11 #include "content/browser/android/synchronous_compositor_host.h" |
| 12 #include "content/browser/gpu/gpu_process_host.h" | 12 #include "content/browser/gpu/gpu_process_host.h" |
| 13 #include "content/browser/web_contents/web_contents_android.h" | 13 #include "content/browser/web_contents/web_contents_android.h" |
| 14 #include "content/browser/web_contents/web_contents_impl.h" | 14 #include "content/browser/web_contents/web_contents_impl.h" |
| 15 #include "content/gpu/in_process_gpu_thread.h" | 15 #include "content/gpu/in_process_gpu_thread.h" |
| 16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class SynchronousCompositorClient; | 20 class SynchronousCompositorClient; |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 const gpu::GpuPreferences* g_gpu_preferences = nullptr; | |
|
boliu
2016/02/26 22:17:32
LazyInstance<gpu::GpuPreferences>, also const won'
Peng
2016/02/29 16:09:22
I don't see why need LazyInstance. But anyway, I r
| |
| 24 gpu::SyncPointManager* g_sync_point_manager = nullptr; | 25 gpu::SyncPointManager* g_sync_point_manager = nullptr; |
| 25 | 26 |
| 26 base::Thread* CreateInProcessGpuThreadForSynchronousCompositor( | 27 base::Thread* CreateInProcessGpuThreadForSynchronousCompositor( |
| 27 const InProcessChildThreadParams& params) { | 28 const InProcessChildThreadParams& params) { |
| 28 DCHECK(g_sync_point_manager); | 29 DCHECK(g_sync_point_manager); |
| 29 return new InProcessGpuThread(params, g_sync_point_manager); | 30 return new InProcessGpuThread(params, g_gpu_preferences, |
| 31 g_sync_point_manager); | |
| 30 } | 32 } |
| 31 | 33 |
| 32 } // namespace | 34 } // namespace |
| 33 | 35 |
| 34 void SynchronousCompositor::SetGpuService( | 36 void SynchronousCompositor::SetGpuService( |
| 35 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { | 37 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
| 38 DCHECK(!g_gpu_preferences); | |
| 36 DCHECK(!g_sync_point_manager); | 39 DCHECK(!g_sync_point_manager); |
| 40 g_gpu_preferences = &service->gpu_preferences(); | |
| 37 g_sync_point_manager = service->sync_point_manager(); | 41 g_sync_point_manager = service->sync_point_manager(); |
| 38 GpuProcessHost::RegisterGpuMainThreadFactory( | 42 GpuProcessHost::RegisterGpuMainThreadFactory( |
| 39 CreateInProcessGpuThreadForSynchronousCompositor); | 43 CreateInProcessGpuThreadForSynchronousCompositor); |
| 40 } | 44 } |
| 41 | 45 |
| 42 // static | 46 // static |
| 43 void SynchronousCompositor::SetClientForWebContents( | 47 void SynchronousCompositor::SetClientForWebContents( |
| 44 WebContents* contents, | 48 WebContents* contents, |
| 45 SynchronousCompositorClient* client) { | 49 SynchronousCompositorClient* client) { |
| 46 DCHECK(contents); | 50 DCHECK(contents); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 67 command_line->HasSwitch(switches::kSingleProcess); | 71 command_line->HasSwitch(switches::kSingleProcess); |
| 68 return make_scoped_ptr(new SynchronousCompositorHost( | 72 return make_scoped_ptr(new SynchronousCompositorHost( |
| 69 rwhva, web_contents_android->synchronous_compositor_client(), | 73 rwhva, web_contents_android->synchronous_compositor_client(), |
| 70 use_in_proc_software_draw)); | 74 use_in_proc_software_draw)); |
| 71 } | 75 } |
| 72 return make_scoped_ptr(new SynchronousCompositorImpl( | 76 return make_scoped_ptr(new SynchronousCompositorImpl( |
| 73 rwhva, web_contents_android->synchronous_compositor_client())); | 77 rwhva, web_contents_android->synchronous_compositor_client())); |
| 74 } | 78 } |
| 75 | 79 |
| 76 } // namespace content | 80 } // namespace content |
| OLD | NEW |