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

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
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..c813d6e8c2f0275450ef6f783afba6a6ae091b6a 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;
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);
}

Powered by Google App Engine
This is Rietveld 408576698