Index: android_webview/browser/browser_view_renderer.cc |
diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc |
index 2fc80229d695b718382f778f1c84ef7e48e0432e..e71482a4a06d6c5711c020f9dc672f434d3b1867 100644 |
--- a/android_webview/browser/browser_view_renderer.cc |
+++ b/android_webview/browser/browser_view_renderer.cc |
@@ -664,6 +664,7 @@ void BrowserViewRenderer::EnsureContinuousInvalidation(bool force_invalidate) { |
if (throttle_fallback_tick) |
return; |
+ base::AutoLock lock(render_thread_lock_); |
block_invalidates_ = compositor_needs_continuous_invalidate_; |
// Unretained here is safe because the callback is cancelled when |
@@ -713,9 +714,21 @@ bool BrowserViewRenderer::CompositeSW(SkCanvas* canvas) { |
} |
void BrowserViewRenderer::DidComposite(bool force_invalidate) { |
- fallback_tick_.Cancel(); |
- block_invalidates_ = false; |
- EnsureContinuousInvalidation(force_invalidate); |
+ { |
+ base::AutoLock lock(render_thread_lock_); |
+ fallback_tick_.Cancel(); |
mkosiba (inactive)
2014/05/12 14:29:51
this doesn't look threadsafe:
from base/cancellab
boliu
2014/05/12 15:34:49
Hmm, good point. There is nothing protecting runni
|
+ block_invalidates_ = false; |
+ } |
+ |
+ if (ui_task_runner_->BelongsToCurrentThread()) { |
+ EnsureContinuousInvalidation(force_invalidate); |
+ return; |
+ } |
+ ui_task_runner_->PostTask( |
+ FROM_HERE, |
+ base::Bind(&BrowserViewRenderer::EnsureContinuousInvalidation, |
+ ui_thread_weak_ptr_, |
+ force_invalidate)); |
} |
std::string BrowserViewRenderer::ToString(AwDrawGLInfo* draw_info) const { |