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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
12 #include "content/public/browser/android/synchronous_compositor.h" | 12 #include "content/public/browser/android/synchronous_compositor.h" |
| 13 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" |
13 #include "gpu/command_buffer/service/shader_translator_cache.h" | 14 #include "gpu/command_buffer/service/shader_translator_cache.h" |
14 #include "gpu/command_buffer/service/sync_point_manager.h" | 15 #include "gpu/command_buffer/service/sync_point_manager.h" |
15 | 16 |
16 namespace android_webview { | 17 namespace android_webview { |
17 | 18 |
18 namespace { | 19 namespace { |
19 base::LazyInstance<scoped_refptr<DeferredGpuCommandService> > | 20 base::LazyInstance<scoped_refptr<DeferredGpuCommandService> > |
20 g_service = LAZY_INSTANCE_INITIALIZER; | 21 g_service = LAZY_INSTANCE_INITIALIZER; |
21 } // namespace | 22 } // namespace |
22 | 23 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 147 |
147 bool DeferredGpuCommandService::UseVirtualizedGLContexts() { return true; } | 148 bool DeferredGpuCommandService::UseVirtualizedGLContexts() { return true; } |
148 | 149 |
149 scoped_refptr<gpu::gles2::ShaderTranslatorCache> | 150 scoped_refptr<gpu::gles2::ShaderTranslatorCache> |
150 DeferredGpuCommandService::shader_translator_cache() { | 151 DeferredGpuCommandService::shader_translator_cache() { |
151 if (!shader_translator_cache_.get()) | 152 if (!shader_translator_cache_.get()) |
152 shader_translator_cache_ = new gpu::gles2::ShaderTranslatorCache; | 153 shader_translator_cache_ = new gpu::gles2::ShaderTranslatorCache; |
153 return shader_translator_cache_; | 154 return shader_translator_cache_; |
154 } | 155 } |
155 | 156 |
| 157 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
| 158 DeferredGpuCommandService::framebuffer_completeness_cache() { |
| 159 if (!framebuffer_completeness_cache_.get()) { |
| 160 framebuffer_completeness_cache_ = |
| 161 new gpu::gles2::FramebufferCompletenessCache; |
| 162 } |
| 163 return framebuffer_completeness_cache_; |
| 164 } |
| 165 |
156 gpu::SyncPointManager* DeferredGpuCommandService::sync_point_manager() { | 166 gpu::SyncPointManager* DeferredGpuCommandService::sync_point_manager() { |
157 return sync_point_manager_.get(); | 167 return sync_point_manager_.get(); |
158 } | 168 } |
159 | 169 |
160 void DeferredGpuCommandService::RunTasks() { | 170 void DeferredGpuCommandService::RunTasks() { |
161 TRACE_EVENT0("android_webview", "DeferredGpuCommandService::RunTasks"); | 171 TRACE_EVENT0("android_webview", "DeferredGpuCommandService::RunTasks"); |
162 bool has_more_tasks; | 172 bool has_more_tasks; |
163 { | 173 { |
164 base::AutoLock lock(tasks_lock_); | 174 base::AutoLock lock(tasks_lock_); |
165 has_more_tasks = tasks_.size() > 0; | 175 has_more_tasks = tasks_.size() > 0; |
(...skipping 16 matching lines...) Expand all Loading... |
182 | 192 |
183 void DeferredGpuCommandService::AddRef() const { | 193 void DeferredGpuCommandService::AddRef() const { |
184 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); | 194 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); |
185 } | 195 } |
186 | 196 |
187 void DeferredGpuCommandService::Release() const { | 197 void DeferredGpuCommandService::Release() const { |
188 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); | 198 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); |
189 } | 199 } |
190 | 200 |
191 } // namespace android_webview | 201 } // namespace android_webview |
OLD | NEW |