Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index 3b051f7d537121c97966616a654e507994355aa8..7665a38ab56ce3c39bdb62ba6a855290d8bbf099 100644 |
--- a/cc/trees/thread_proxy.cc |
+++ b/cc/trees/thread_proxy.cc |
@@ -546,12 +546,21 @@ void ThreadProxy::Stop() { |
DCHECK(IsMainThread()); |
DCHECK(started_); |
- // Synchronously deletes the impl. |
+ // Synchronously finishes pending GL operations and deletes the impl. |
{ |
DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
CompletionEvent completion; |
Proxy::ImplThread()->PostTask( |
+ base::Bind(&ThreadProxy::FinishGLOnImplThread, |
+ impl_thread_weak_ptr_, |
+ &completion)); |
+ completion.Wait(); |
+ } { |
+ DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
+ |
+ CompletionEvent completion; |
+ Proxy::ImplThread()->PostTask( |
base::Bind(&ThreadProxy::LayerTreeHostClosedOnImplThread, |
impl_thread_weak_ptr_, |
&completion)); |
@@ -1153,6 +1162,14 @@ void ThreadProxy::InitializeRendererOnImplThread( |
completion->Signal(); |
} |
+void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |
+ TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); |
+ DCHECK(IsImplThread()); |
+ if (layer_tree_host_impl_->resource_provider()) |
+ layer_tree_host_impl_->resource_provider()->Finish(); |
+ completion->Signal(); |
+} |
+ |
void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
DCHECK(IsImplThread()); |