Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index 8e44bb4fe999c6b8254f901471d54ff686f54cf5..6fffabbe1fadd7686d9ec1ef4bc1e6dff04b85a1 100644 |
--- a/cc/trees/thread_proxy.cc |
+++ b/cc/trees/thread_proxy.cc |
@@ -535,12 +535,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(); |
+ } { |
piman
2013/04/27 00:42:25
nit: we usually put those on separate lines.
Also
danakj
2013/04/29 14:59:05
So, my thinking was that Finish will cause callbac
piman
2013/04/29 17:29:13
Ok, I see. I didn't think it would generally work
danakj
2013/04/30 01:30:52
Done.
|
+ DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
+ |
+ CompletionEvent completion; |
+ Proxy::ImplThread()->PostTask( |
base::Bind(&ThreadProxy::LayerTreeHostClosedOnImplThread, |
impl_thread_weak_ptr_, |
&completion)); |
@@ -1172,6 +1181,14 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread( |
completion->Signal(); |
} |
+void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |
+ TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
piman
2013/04/27 00:42:25
nit: copy & paste of trace, I saw that.
danakj
2013/04/29 14:59:05
Done. *^_^*
|
+ 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()); |