Index: android_webview/browser/deferred_gpu_command_service.cc |
diff --git a/android_webview/browser/deferred_gpu_command_service.cc b/android_webview/browser/deferred_gpu_command_service.cc |
index 601334ae7f923f6860811a76a163ad612ecc4585..a680c7be01fa4c719d68481ec78d182ce10ce1f0 100644 |
--- a/android_webview/browser/deferred_gpu_command_service.cc |
+++ b/android_webview/browser/deferred_gpu_command_service.cc |
@@ -41,6 +41,12 @@ void DeferredGpuCommandService::SetInstance() { |
} |
} |
+// static |
+DeferredGpuCommandService* DeferredGpuCommandService::GetInstance() { |
+ DCHECK(g_service.Get().get()); |
+ return g_service.Get().get(); |
+} |
+ |
DeferredGpuCommandService::DeferredGpuCommandService() {} |
DeferredGpuCommandService::~DeferredGpuCommandService() { |
@@ -48,8 +54,9 @@ DeferredGpuCommandService::~DeferredGpuCommandService() { |
DCHECK(tasks_.empty()); |
} |
+// This method can be called on any thread. |
// static |
-void DeferredGpuCommandService::RequestProcessGLOnUIThread() { |
+void DeferredGpuCommandService::RequestProcessGL() { |
SharedRendererState* renderer_state = |
GLViewRendererManager::GetInstance()->GetMostRecentlyDrawn(); |
if (!renderer_state) { |
@@ -68,7 +75,8 @@ void DeferredGpuCommandService::ScheduleTask(const base::Closure& task) { |
if (ScopedAllowGL::IsAllowed()) { |
RunTasks(); |
} else { |
- RequestProcessGLOnUIThread(); |
+ // TODO(boliu): Improve this to avoid PostTask storm. |
+ RequestProcessGL(); |
} |
} |