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

Unified Diff: cc/trees/proxy_main.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
Index: cc/trees/proxy_main.cc
diff --git a/cc/trees/proxy_main.cc b/cc/trees/proxy_main.cc
index de79051d4b38e3395e219f1054e431150859bd37..783e8bad891d316c9bbd728dab9b0b2d915b2506 100644
--- a/cc/trees/proxy_main.cc
+++ b/cc/trees/proxy_main.cc
@@ -36,6 +36,7 @@ ProxyMain::ProxyMain(LayerTreeHost* layer_tree_host,
commit_waits_for_activation_(false),
started_(false),
defer_commits_(false),
+ compositor_frame_sink_weak_factory_(this),
weak_factory_(this) {
TRACE_EVENT0("cc", "ProxyMain::ProxyMain");
DCHECK(task_runner_provider_);
@@ -88,6 +89,7 @@ void ProxyMain::SetAnimationEvents(std::unique_ptr<MutatorEvents> events) {
void ProxyMain::DidLoseCompositorFrameSink() {
TRACE_EVENT0("cc", "ProxyMain::DidLoseCompositorFrameSink");
DCHECK(IsMainThread());
+ compositor_frame_sink_weak_factory_.InvalidateWeakPtrs();
layer_tree_host_->DidLoseCompositorFrameSink();
}
@@ -289,7 +291,8 @@ void ProxyMain::SetCompositorFrameSink(
ImplThreadTaskRunner()->PostTask(
FROM_HERE,
base::Bind(&ProxyImpl::InitializeCompositorFrameSinkOnImpl,
- base::Unretained(proxy_impl_.get()), compositor_frame_sink));
+ base::Unretained(proxy_impl_.get()), compositor_frame_sink,
+ compositor_frame_sink_weak_factory_.GetWeakPtr()));
}
void ProxyMain::SetVisible(bool visible) {
@@ -466,6 +469,7 @@ bool ProxyMain::MainFrameWillHappenForTesting() {
void ProxyMain::ReleaseCompositorFrameSink() {
DCHECK(IsMainThread());
+ compositor_frame_sink_weak_factory_.InvalidateWeakPtrs();
DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
CompletionEvent completion;
ImplThreadTaskRunner()->PostTask(

Powered by Google App Engine
This is Rietveld 408576698