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/shared_renderer_state.h" | 8 #include "android_webview/browser/shared_renderer_state.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // static | 24 // static |
25 bool ScopedAllowGL::IsAllowed() { | 25 bool ScopedAllowGL::IsAllowed() { |
26 return allow_gl.Get().Get(); | 26 return allow_gl.Get().Get(); |
27 } | 27 } |
28 | 28 |
29 ScopedAllowGL::ScopedAllowGL() { | 29 ScopedAllowGL::ScopedAllowGL() { |
30 DCHECK(!allow_gl.Get().Get()); | 30 DCHECK(!allow_gl.Get().Get()); |
31 allow_gl.Get().Set(true); | 31 allow_gl.Get().Set(true); |
32 | 32 |
33 if (g_service.Get()) | 33 if (g_service.Get().get()) |
34 g_service.Get()->RunTasks(); | 34 g_service.Get()->RunTasks(); |
35 } | 35 } |
36 | 36 |
37 ScopedAllowGL::~ScopedAllowGL() { | 37 ScopedAllowGL::~ScopedAllowGL() { |
38 allow_gl.Get().Set(false); | 38 allow_gl.Get().Set(false); |
39 | 39 |
40 DeferredGpuCommandService* service = g_service.Get(); | 40 DeferredGpuCommandService* service = g_service.Get().get(); |
41 if (service) { | 41 if (service) { |
42 service->RunTasks(); | 42 service->RunTasks(); |
43 if (service->IdleQueueSize()) { | 43 if (service->IdleQueueSize()) { |
44 service->RequestProcessGL(); | 44 service->RequestProcessGL(); |
45 } | 45 } |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 // static | 49 // static |
50 void DeferredGpuCommandService::SetInstance() { | 50 void DeferredGpuCommandService::SetInstance() { |
51 if (!g_service.Get()) { | 51 if (!g_service.Get().get()) { |
52 g_service.Get() = new DeferredGpuCommandService; | 52 g_service.Get() = new DeferredGpuCommandService; |
53 content::SynchronousCompositor::SetGpuService(g_service.Get()); | 53 content::SynchronousCompositor::SetGpuService(g_service.Get()); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 // static | 57 // static |
58 DeferredGpuCommandService* DeferredGpuCommandService::GetInstance() { | 58 DeferredGpuCommandService* DeferredGpuCommandService::GetInstance() { |
59 DCHECK(g_service.Get().get()); | 59 DCHECK(g_service.Get().get()); |
60 return g_service.Get().get(); | 60 return g_service.Get().get(); |
61 } | 61 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 void DeferredGpuCommandService::AddRef() const { | 176 void DeferredGpuCommandService::AddRef() const { |
177 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); | 177 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); |
178 } | 178 } |
179 | 179 |
180 void DeferredGpuCommandService::Release() const { | 180 void DeferredGpuCommandService::Release() const { |
181 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); | 181 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); |
182 } | 182 } |
183 | 183 |
184 } // namespace android_webview | 184 } // namespace android_webview |
OLD | NEW |