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

Unified 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, 10 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/synchronous_compositor_base.cc
diff --git a/content/browser/android/synchronous_compositor_base.cc b/content/browser/android/synchronous_compositor_base.cc
index e218d4020d143893b23da78d98cc8861ea145cde..1ef5e861c9836008f8f1b7e98ba9b3239b1e1263 100644
--- a/content/browser/android/synchronous_compositor_base.cc
+++ b/content/browser/android/synchronous_compositor_base.cc
@@ -21,20 +21,23 @@ 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);
+ DCHECK(g_gpu_service.Get());
+ return new InProcessGpuThread(params,
+ g_gpu_service.Get()->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);
}
« 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