Index: cc/trees/single_thread_proxy.cc |
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc |
index 0386145c7c55fea08e4f34362dd5f3536b1b1a02..3e307bb7b1a54e5cfd92b0aa1f9d373ae9269d4d 100644 |
--- a/cc/trees/single_thread_proxy.cc |
+++ b/cc/trees/single_thread_proxy.cc |
@@ -425,7 +425,12 @@ void SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread() { |
"SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread"); |
if (scheduler_on_impl_thread_) |
scheduler_on_impl_thread_->DidReceiveCompositorFrameAck(); |
- layer_tree_host_->DidReceiveCompositorFrameAck(); |
+ // We do a PostTask here because freeing resources in some cases (such as in |
+ // TextureLayer) is PostTasked and we want to make sure ack is received after |
+ // resources are returned. |
+ task_runner_provider_->MainThreadTaskRunner()->PostTask( |
+ FROM_HERE, base::Bind(&SingleThreadProxy::DidReceiveCompositorFrameAck, |
+ weak_factory_.GetWeakPtr())); |
} |
void SingleThreadProxy::OnDrawForCompositorFrameSink( |
@@ -794,4 +799,9 @@ void SingleThreadProxy::DidFinishImplFrame() { |
#endif |
} |
+void SingleThreadProxy::DidReceiveCompositorFrameAck() { |
+ if (layer_tree_host_) |
danakj
2017/04/04 19:20:54
This is unusual in this file, the host is only nul
Saman Sami
2017/04/04 19:32:31
I'm not familiar with lifetime of layer_tree_host_
danakj
2017/04/04 19:36:21
I'm quite against branches just-in-case, and want
Saman Sami
2017/04/04 21:39:14
Done.
|
+ layer_tree_host_->DidReceiveCompositorFrameAck(); |
+} |
+ |
} // namespace cc |