summaryrefslogtreecommitdiffstats
path: root/android_webview/browser
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-21 20:54:28 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-21 20:54:28 +0000
commit13f844985107cf47dc5aefbb1710ad7a09425411 (patch)
tree9ef4781d939a297327f1a5d7d8943443b5485e3a /android_webview/browser
parent8d8f9c2dd030a8072822394d8f5d3ff34be9842a (diff)
downloadchromium_src-13f844985107cf47dc5aefbb1710ad7a09425411.zip
chromium_src-13f844985107cf47dc5aefbb1710ad7a09425411.tar.gz
chromium_src-13f844985107cf47dc5aefbb1710ad7a09425411.tar.bz2
[Android WebView] Call RequestProcessGL on UI thread
Currently we are not guaranteed to call RequestProcessGL on the UI thread which is a threading bug that can cause coruption/crashes. BUG=277055 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/23060021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/browser')
-rw-r--r--android_webview/browser/in_process_view_renderer.cc24
1 files changed, 18 insertions, 6 deletions
diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc
index d9f8232..3f935ff 100644
--- a/android_webview/browser/in_process_view_renderer.cc
+++ b/android_webview/browser/in_process_view_renderer.cc
@@ -171,6 +171,21 @@ bool ScopedAllowGL::allow_gl = false;
base::LazyInstance<GLViewRendererManager>::Leaky g_view_renderer_manager;
+void RequestProcessGLOnUIThread() {
+ if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE, base::Bind(&RequestProcessGLOnUIThread));
+ return;
+ }
+
+ InProcessViewRenderer* renderer = static_cast<InProcessViewRenderer*>(
+ g_view_renderer_manager.Get().GetMostRecentlyDrawn());
+ if (!renderer || !renderer->RequestProcessGL()) {
+ LOG(ERROR) << "Failed to request GL process. Deadlock likely: "
+ << !!renderer;
+ }
+}
+
} // namespace
// Called from different threads!
@@ -178,11 +193,7 @@ static void ScheduleGpuWork() {
if (ScopedAllowGL::IsAllowed()) {
gpu::InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread();
} else {
- InProcessViewRenderer* renderer = static_cast<InProcessViewRenderer*>(
- g_view_renderer_manager.Get().GetMostRecentlyDrawn());
- if (!renderer || !renderer->RequestProcessGL()) {
- LOG(ERROR) << "Failed to request DrawGL. Probably going to deadlock.";
- }
+ RequestProcessGLOnUIThread();
}
}
@@ -772,7 +783,8 @@ void InProcessViewRenderer::EnsureContinuousInvalidation(
// ticked. This can happen if this is reached because
// invalidate_ignore_compositor is true.
if (compositor_needs_continuous_invalidate_) {
- base::MessageLoop::current()->PostDelayedTask(
+ BrowserThread::PostDelayedTask(
+ BrowserThread::UI,
FROM_HERE,
fallback_tick_.callback(),
base::TimeDelta::FromMilliseconds(