| Index: cc/trees/thread_proxy.cc
|
| diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
|
| index ef8cce707f4fb904177cd22f64a4516866075b00..60c045205893ca5a609e642ea1232b7c340d5919 100644
|
| --- a/cc/trees/thread_proxy.cc
|
| +++ b/cc/trees/thread_proxy.cc
|
| @@ -547,7 +547,20 @@ void ThreadProxy::Stop() {
|
| DCHECK(IsMainThread());
|
| DCHECK(started_);
|
|
|
| - // Synchronously deletes the impl.
|
| + // Synchronously finishes pending GL operations and deletes the impl.
|
| + // The two steps are done as separate post tasks, so that tasks posted
|
| + // by the GL implementation due to the Finish can be executed by the
|
| + // renderer before shutting it down.
|
| + {
|
| + 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);
|
|
|
| @@ -1157,6 +1170,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());
|
|
|