| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 bool DeferredGpuCommandService::UseVirtualizedGLContexts() { return true; } | 145 bool DeferredGpuCommandService::UseVirtualizedGLContexts() { return true; } |
| 146 | 146 |
| 147 scoped_refptr<gpu::gles2::ShaderTranslatorCache> | 147 scoped_refptr<gpu::gles2::ShaderTranslatorCache> |
| 148 DeferredGpuCommandService::shader_translator_cache() { | 148 DeferredGpuCommandService::shader_translator_cache() { |
| 149 if (!shader_translator_cache_.get()) | 149 if (!shader_translator_cache_.get()) |
| 150 shader_translator_cache_ = new gpu::gles2::ShaderTranslatorCache; | 150 shader_translator_cache_ = new gpu::gles2::ShaderTranslatorCache; |
| 151 return shader_translator_cache_; | 151 return shader_translator_cache_; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void DeferredGpuCommandService::RunTasks() { | 154 void DeferredGpuCommandService::RunTasks() { |
| 155 TRACE_EVENT0("android_webview", "DeferredGpuCommandService::RunTasks"); |
| 155 bool has_more_tasks; | 156 bool has_more_tasks; |
| 156 { | 157 { |
| 157 base::AutoLock lock(tasks_lock_); | 158 base::AutoLock lock(tasks_lock_); |
| 158 has_more_tasks = tasks_.size() > 0; | 159 has_more_tasks = tasks_.size() > 0; |
| 159 } | 160 } |
| 160 | 161 |
| 161 while (has_more_tasks) { | 162 while (has_more_tasks) { |
| 162 base::Closure task; | 163 base::Closure task; |
| 163 { | 164 { |
| 164 base::AutoLock lock(tasks_lock_); | 165 base::AutoLock lock(tasks_lock_); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 175 | 176 |
| 176 void DeferredGpuCommandService::AddRef() const { | 177 void DeferredGpuCommandService::AddRef() const { |
| 177 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); | 178 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); |
| 178 } | 179 } |
| 179 | 180 |
| 180 void DeferredGpuCommandService::Release() const { | 181 void DeferredGpuCommandService::Release() const { |
| 181 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); | 182 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); |
| 182 } | 183 } |
| 183 | 184 |
| 184 } // namespace android_webview | 185 } // namespace android_webview |
| OLD | NEW |