OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "android_webview/browser/deferred_gpu_command_service.h" | 5 #include "android_webview/browser/deferred_gpu_command_service.h" |
6 | 6 |
7 #include "android_webview/browser/gl_view_renderer_manager.h" | 7 #include "android_webview/browser/gl_view_renderer_manager.h" |
8 #include "android_webview/browser/render_thread_manager.h" | 8 #include "android_webview/browser/render_thread_manager.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "content/public/browser/android/synchronous_compositor.h" | |
15 #include "content/public/browser/gpu_utils.h" | 14 #include "content/public/browser/gpu_utils.h" |
16 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
17 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" | 16 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" |
18 #include "gpu/command_buffer/service/gpu_preferences.h" | 17 #include "gpu/command_buffer/service/gpu_preferences.h" |
19 #include "gpu/command_buffer/service/gpu_switches.h" | 18 #include "gpu/command_buffer/service/gpu_switches.h" |
20 #include "gpu/command_buffer/service/shader_translator_cache.h" | 19 #include "gpu/command_buffer/service/shader_translator_cache.h" |
21 #include "gpu/command_buffer/service/sync_point_manager.h" | 20 #include "gpu/command_buffer/service/sync_point_manager.h" |
22 #include "gpu/config/gpu_switches.h" | 21 #include "gpu/config/gpu_switches.h" |
23 #include "ui/gl/gl_switches.h" | 22 #include "ui/gl/gl_switches.h" |
24 | 23 |
(...skipping 27 matching lines...) Expand all Loading... |
52 if (service) { | 51 if (service) { |
53 service->RunTasks(); | 52 service->RunTasks(); |
54 if (service->IdleQueueSize()) { | 53 if (service->IdleQueueSize()) { |
55 service->RequestProcessGL(true); | 54 service->RequestProcessGL(true); |
56 } | 55 } |
57 } | 56 } |
58 } | 57 } |
59 | 58 |
60 // static | 59 // static |
61 void DeferredGpuCommandService::SetInstance() { | 60 void DeferredGpuCommandService::SetInstance() { |
62 if (!g_service.Get().get()) { | 61 if (!g_service.Get().get()) |
63 g_service.Get() = new DeferredGpuCommandService; | 62 g_service.Get() = new DeferredGpuCommandService; |
64 content::SynchronousCompositor::SetGpuService(g_service.Get()); | |
65 } | |
66 } | 63 } |
67 | 64 |
68 // static | 65 // static |
69 DeferredGpuCommandService* DeferredGpuCommandService::GetInstance() { | 66 DeferredGpuCommandService* DeferredGpuCommandService::GetInstance() { |
70 DCHECK(g_service.Get().get()); | 67 DCHECK(g_service.Get().get()); |
71 return g_service.Get().get(); | 68 return g_service.Get().get(); |
72 } | 69 } |
73 | 70 |
74 DeferredGpuCommandService::DeferredGpuCommandService() | 71 DeferredGpuCommandService::DeferredGpuCommandService() |
75 : gpu::InProcessCommandBuffer::Service( | 72 : gpu::InProcessCommandBuffer::Service( |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 203 |
207 void DeferredGpuCommandService::AddRef() const { | 204 void DeferredGpuCommandService::AddRef() const { |
208 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); | 205 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); |
209 } | 206 } |
210 | 207 |
211 void DeferredGpuCommandService::Release() const { | 208 void DeferredGpuCommandService::Release() const { |
212 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); | 209 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); |
213 } | 210 } |
214 | 211 |
215 } // namespace android_webview | 212 } // namespace android_webview |
OLD | NEW |