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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 2757373002: Fixing flakiness of TextureLayerChangeInvisibleMailboxTest (Closed)
Patch Set: Invalidate on DidLose 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
« cc/trees/proxy_impl.cc ('K') | « 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 0386145c7c55fea08e4f34362dd5f3536b1b1a02..668ba9190cd9503a5ddbd131ca574c17f3ed57a0 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),
+ compositor_frame_sink_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;
+ compositor_frame_sink_weak_factory_.InvalidateWeakPtrs();
if (scheduler_on_impl_thread_)
scheduler_on_impl_thread_->DidLoseCompositorFrameSink();
return layer_tree_host_impl_->ReleaseCompositorFrameSink();
@@ -403,6 +405,7 @@ void SingleThreadProxy::DidCompletePageScaleAnimationOnImplThread() {
void SingleThreadProxy::DidLoseCompositorFrameSinkOnImplThread() {
TRACE_EVENT0("cc",
"SingleThreadProxy::DidLoseCompositorFrameSinkOnImplThread");
+ compositor_frame_sink_weak_factory_.InvalidateWeakPtrs();
{
DebugScopedSetMainThread main(task_runner_provider_);
// This must happen before we notify the scheduler as it may try to recreate
@@ -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,
+ compositor_frame_sink_weak_factory_.GetWeakPtr()));
}
void SingleThreadProxy::OnDrawForCompositorFrameSink(
@@ -794,4 +802,8 @@ void SingleThreadProxy::DidFinishImplFrame() {
#endif
}
+void SingleThreadProxy::DidReceiveCompositorFrameAck() {
+ layer_tree_host_->DidReceiveCompositorFrameAck();
+}
+
} // namespace cc
« cc/trees/proxy_impl.cc ('K') | « cc/trees/single_thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698