Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: content/browser/android/synchronous_compositor_base.cc

Issue 1716813002: Use GpuPreferences to avoid directly accessing switches in gpu related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/gles2/gpu_state.h ('k') | content/common/gpu/gpu_channel_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 gpu::SyncPointManager* g_sync_point_manager = nullptr; 24 base::LazyInstance<scoped_refptr<gpu::InProcessCommandBuffer::Service>>
25 g_gpu_service = LAZY_INSTANCE_INITIALIZER;
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_gpu_service.Get());
29 return new InProcessGpuThread(params, g_sync_point_manager); 30 return new InProcessGpuThread(params,
31 g_gpu_service.Get()->gpu_preferences(),
32 g_gpu_service.Get()->sync_point_manager());
30 } 33 }
31 34
32 } // namespace 35 } // namespace
33 36
34 void SynchronousCompositor::SetGpuService( 37 void SynchronousCompositor::SetGpuService(
35 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { 38 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) {
36 DCHECK(!g_sync_point_manager); 39 DCHECK(!g_gpu_service.Get());
37 g_sync_point_manager = service->sync_point_manager(); 40 g_gpu_service.Get() = service;
38 GpuProcessHost::RegisterGpuMainThreadFactory( 41 GpuProcessHost::RegisterGpuMainThreadFactory(
39 CreateInProcessGpuThreadForSynchronousCompositor); 42 CreateInProcessGpuThreadForSynchronousCompositor);
40 } 43 }
41 44
42 // static 45 // static
43 void SynchronousCompositor::SetClientForWebContents( 46 void SynchronousCompositor::SetClientForWebContents(
44 WebContents* contents, 47 WebContents* contents,
45 SynchronousCompositorClient* client) { 48 SynchronousCompositorClient* client) {
46 DCHECK(contents); 49 DCHECK(contents);
47 DCHECK(client); 50 DCHECK(client);
(...skipping 19 matching lines...) Expand all
67 command_line->HasSwitch(switches::kSingleProcess); 70 command_line->HasSwitch(switches::kSingleProcess);
68 return make_scoped_ptr(new SynchronousCompositorHost( 71 return make_scoped_ptr(new SynchronousCompositorHost(
69 rwhva, web_contents_android->synchronous_compositor_client(), 72 rwhva, web_contents_android->synchronous_compositor_client(),
70 use_in_proc_software_draw)); 73 use_in_proc_software_draw));
71 } 74 }
72 return make_scoped_ptr(new SynchronousCompositorImpl( 75 return make_scoped_ptr(new SynchronousCompositorImpl(
73 rwhva, web_contents_android->synchronous_compositor_client())); 76 rwhva, web_contents_android->synchronous_compositor_client()));
74 } 77 }
75 78
76 } // namespace content 79 } // namespace content
OLDNEW
« no previous file with comments | « components/mus/gles2/gpu_state.h ('k') | content/common/gpu/gpu_channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698