| 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/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" | 14 #include "content/public/browser/android/synchronous_compositor.h" |
| 15 #include "content/public/browser/gpu_utils.h" | 15 #include "content/public/browser/gpu_utils.h" |
| 16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 17 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" | 17 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" |
| 18 #include "gpu/command_buffer/service/gpu_preferences.h" | 18 #include "gpu/command_buffer/service/gpu_preferences.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 DeferredGpuCommandService::~DeferredGpuCommandService() { | 80 DeferredGpuCommandService::~DeferredGpuCommandService() { |
| 81 base::AutoLock lock(tasks_lock_); | 81 base::AutoLock lock(tasks_lock_); |
| 82 DCHECK(tasks_.empty()); | 82 DCHECK(tasks_.empty()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // This method can be called on any thread. | 85 // This method can be called on any thread. |
| 86 // static | 86 // static |
| 87 void DeferredGpuCommandService::RequestProcessGL(bool for_idle) { | 87 void DeferredGpuCommandService::RequestProcessGL(bool for_idle) { |
| 88 SharedRendererState* renderer_state = | 88 RenderThreadManager* renderer_state = |
| 89 GLViewRendererManager::GetInstance()->GetMostRecentlyDrawn(); | 89 GLViewRendererManager::GetInstance()->GetMostRecentlyDrawn(); |
| 90 if (!renderer_state) { | 90 if (!renderer_state) { |
| 91 LOG(ERROR) << "No hardware renderer. Deadlock likely"; | 91 LOG(ERROR) << "No hardware renderer. Deadlock likely"; |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 renderer_state->ClientRequestDrawGL(for_idle); | 94 renderer_state->ClientRequestDrawGL(for_idle); |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Called from different threads! | 97 // Called from different threads! |
| 98 void DeferredGpuCommandService::ScheduleTask(const base::Closure& task) { | 98 void DeferredGpuCommandService::ScheduleTask(const base::Closure& task) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 void DeferredGpuCommandService::AddRef() const { | 207 void DeferredGpuCommandService::AddRef() const { |
| 208 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); | 208 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void DeferredGpuCommandService::Release() const { | 211 void DeferredGpuCommandService::Release() const { |
| 212 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); | 212 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace android_webview | 215 } // namespace android_webview |
| OLD | NEW |