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 "android_webview/common/aw_switches.h" |
| 10 #include "base/command_line.h" |
9 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
10 #include "content/public/browser/android/synchronous_compositor.h" | 12 #include "content/public/browser/android/synchronous_compositor.h" |
11 #include "gpu/command_buffer/service/shader_translator_cache.h" | 13 #include "gpu/command_buffer/service/shader_translator_cache.h" |
12 | 14 |
13 namespace android_webview { | 15 namespace android_webview { |
14 | 16 |
15 namespace { | 17 namespace { |
16 | 18 |
17 // TODO(boliu): Consider using base/atomicops.h. | 19 // TODO(boliu): Consider using base/atomicops.h. |
18 class ThreadSafeBool { | 20 class ThreadSafeBool { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 70 |
69 if (g_service.Get()) | 71 if (g_service.Get()) |
70 g_service.Get()->RunTasks(); | 72 g_service.Get()->RunTasks(); |
71 } | 73 } |
72 | 74 |
73 // static | 75 // static |
74 void DeferredGpuCommandService::SetInstance() { | 76 void DeferredGpuCommandService::SetInstance() { |
75 if (!g_service.Get()) { | 77 if (!g_service.Get()) { |
76 g_service.Get() = new DeferredGpuCommandService; | 78 g_service.Get() = new DeferredGpuCommandService; |
77 content::SynchronousCompositor::SetGpuService(g_service.Get()); | 79 content::SynchronousCompositor::SetGpuService(g_service.Get()); |
| 80 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 81 switches::kDisableRecordDocumentWorkaround)) { |
| 82 content::SynchronousCompositor::DisableRecordDocumentWorkaround(); |
| 83 } |
78 | 84 |
79 // Initialize global booleans. | 85 // Initialize global booleans. |
80 g_request_pending.Get().Set(false); | 86 g_request_pending.Get().Set(false); |
81 } | 87 } |
82 } | 88 } |
83 | 89 |
84 // static | 90 // static |
85 DeferredGpuCommandService* DeferredGpuCommandService::GetInstance() { | 91 DeferredGpuCommandService* DeferredGpuCommandService::GetInstance() { |
86 DCHECK(g_service.Get().get()); | 92 DCHECK(g_service.Get().get()); |
87 return g_service.Get().get(); | 93 return g_service.Get().get(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 167 |
162 void DeferredGpuCommandService::AddRef() const { | 168 void DeferredGpuCommandService::AddRef() const { |
163 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); | 169 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); |
164 } | 170 } |
165 | 171 |
166 void DeferredGpuCommandService::Release() const { | 172 void DeferredGpuCommandService::Release() const { |
167 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); | 173 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); |
168 } | 174 } |
169 | 175 |
170 } // namespace android_webview | 176 } // namespace android_webview |
OLD | NEW |