Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3742)

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 2757373002: Fixing flakiness of TextureLayerChangeInvisibleMailboxTest (Closed)
Patch Set: c Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/single_thread_proxy.cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 07b5afa607a72b95240466e413a98e6d880c3ae8..29821e38ae2a7fa2e212bf98f304617091db6c92 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -52,6 +52,7 @@ SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host,
inside_synchronous_composite_(false),
compositor_frame_sink_creation_requested_(false),
compositor_frame_sink_lost_(true),
+ frame_sink_bound_weak_factory_(this),
weak_factory_(this) {
TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
DCHECK(task_runner_provider_);
@@ -123,6 +124,7 @@ void SingleThreadProxy::RequestNewCompositorFrameSink() {
void SingleThreadProxy::ReleaseCompositorFrameSink() {
compositor_frame_sink_lost_ = true;
+ frame_sink_bound_weak_factory_.InvalidateWeakPtrs();
if (scheduler_on_impl_thread_)
scheduler_on_impl_thread_->DidLoseCompositorFrameSink();
return layer_tree_host_impl_->ReleaseCompositorFrameSink();
@@ -141,6 +143,7 @@ void SingleThreadProxy::SetCompositorFrameSink(
}
if (success) {
+ frame_sink_bound_weak_ptr_ = frame_sink_bound_weak_factory_.GetWeakPtr();
layer_tree_host_->DidInitializeCompositorFrameSink();
if (scheduler_on_impl_thread_)
scheduler_on_impl_thread_->DidCreateAndInitializeCompositorFrameSink();
@@ -425,7 +428,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,
+ frame_sink_bound_weak_ptr_));
}
void SingleThreadProxy::OnDrawForCompositorFrameSink(
@@ -794,4 +802,8 @@ void SingleThreadProxy::DidFinishImplFrame() {
#endif
}
+void SingleThreadProxy::DidReceiveCompositorFrameAck() {
+ layer_tree_host_->DidReceiveCompositorFrameAck();
+}
+
} // namespace cc
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698