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

Side by Side Diff: cc/trees/proxy_main.cc

Issue 2757373002: Fixing flakiness of TextureLayerChangeInvisibleMailboxTest (Closed)
Patch Set: Rename 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/proxy_main.h" 5 #include "cc/trees/proxy_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 18 matching lines...) Expand all
29 TaskRunnerProvider* task_runner_provider) 29 TaskRunnerProvider* task_runner_provider)
30 : layer_tree_host_(layer_tree_host), 30 : layer_tree_host_(layer_tree_host),
31 task_runner_provider_(task_runner_provider), 31 task_runner_provider_(task_runner_provider),
32 layer_tree_host_id_(layer_tree_host->GetId()), 32 layer_tree_host_id_(layer_tree_host->GetId()),
33 max_requested_pipeline_stage_(NO_PIPELINE_STAGE), 33 max_requested_pipeline_stage_(NO_PIPELINE_STAGE),
34 current_pipeline_stage_(NO_PIPELINE_STAGE), 34 current_pipeline_stage_(NO_PIPELINE_STAGE),
35 final_pipeline_stage_(NO_PIPELINE_STAGE), 35 final_pipeline_stage_(NO_PIPELINE_STAGE),
36 commit_waits_for_activation_(false), 36 commit_waits_for_activation_(false),
37 started_(false), 37 started_(false),
38 defer_commits_(false), 38 defer_commits_(false),
39 frame_sink_bound_weak_factory_(this),
39 weak_factory_(this) { 40 weak_factory_(this) {
40 TRACE_EVENT0("cc", "ProxyMain::ProxyMain"); 41 TRACE_EVENT0("cc", "ProxyMain::ProxyMain");
41 DCHECK(task_runner_provider_); 42 DCHECK(task_runner_provider_);
42 DCHECK(IsMainThread()); 43 DCHECK(IsMainThread());
43 } 44 }
44 45
45 ProxyMain::~ProxyMain() { 46 ProxyMain::~ProxyMain() {
46 TRACE_EVENT0("cc", "ProxyMain::~ProxyMain"); 47 TRACE_EVENT0("cc", "ProxyMain::~ProxyMain");
47 DCHECK(IsMainThread()); 48 DCHECK(IsMainThread());
48 DCHECK(!started_); 49 DCHECK(!started_);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 82
82 void ProxyMain::SetAnimationEvents(std::unique_ptr<MutatorEvents> events) { 83 void ProxyMain::SetAnimationEvents(std::unique_ptr<MutatorEvents> events) {
83 TRACE_EVENT0("cc", "ProxyMain::SetAnimationEvents"); 84 TRACE_EVENT0("cc", "ProxyMain::SetAnimationEvents");
84 DCHECK(IsMainThread()); 85 DCHECK(IsMainThread());
85 layer_tree_host_->SetAnimationEvents(std::move(events)); 86 layer_tree_host_->SetAnimationEvents(std::move(events));
86 } 87 }
87 88
88 void ProxyMain::DidLoseCompositorFrameSink() { 89 void ProxyMain::DidLoseCompositorFrameSink() {
89 TRACE_EVENT0("cc", "ProxyMain::DidLoseCompositorFrameSink"); 90 TRACE_EVENT0("cc", "ProxyMain::DidLoseCompositorFrameSink");
90 DCHECK(IsMainThread()); 91 DCHECK(IsMainThread());
92 frame_sink_bound_weak_factory_.InvalidateWeakPtrs();
danakj 2017/04/18 20:58:42 I would either add a unit test for this case too o
Saman Sami 2017/04/18 21:37:13 Removed to keep things simple. If we ever need thi
91 layer_tree_host_->DidLoseCompositorFrameSink(); 93 layer_tree_host_->DidLoseCompositorFrameSink();
92 } 94 }
93 95
94 void ProxyMain::RequestNewCompositorFrameSink() { 96 void ProxyMain::RequestNewCompositorFrameSink() {
95 TRACE_EVENT0("cc", "ProxyMain::RequestNewCompositorFrameSink"); 97 TRACE_EVENT0("cc", "ProxyMain::RequestNewCompositorFrameSink");
96 DCHECK(IsMainThread()); 98 DCHECK(IsMainThread());
97 layer_tree_host_->RequestNewCompositorFrameSink(); 99 layer_tree_host_->RequestNewCompositorFrameSink();
98 } 100 }
99 101
100 void ProxyMain::DidInitializeCompositorFrameSink(bool success) { 102 void ProxyMain::DidInitializeCompositorFrameSink(bool success) {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 293
292 bool ProxyMain::CommitToActiveTree() const { 294 bool ProxyMain::CommitToActiveTree() const {
293 // With ProxyMain, we use a pending tree and activate it once it's ready to 295 // With ProxyMain, we use a pending tree and activate it once it's ready to
294 // draw to allow input to modify the active tree and draw during raster. 296 // draw to allow input to modify the active tree and draw during raster.
295 return false; 297 return false;
296 } 298 }
297 299
298 void ProxyMain::SetCompositorFrameSink( 300 void ProxyMain::SetCompositorFrameSink(
299 CompositorFrameSink* compositor_frame_sink) { 301 CompositorFrameSink* compositor_frame_sink) {
300 ImplThreadTaskRunner()->PostTask( 302 ImplThreadTaskRunner()->PostTask(
301 FROM_HERE, base::BindOnce(&ProxyImpl::InitializeCompositorFrameSinkOnImpl, 303 FROM_HERE,
302 base::Unretained(proxy_impl_.get()), 304 base::BindOnce(&ProxyImpl::InitializeCompositorFrameSinkOnImpl,
303 compositor_frame_sink)); 305 base::Unretained(proxy_impl_.get()), compositor_frame_sink,
306 frame_sink_bound_weak_factory_.GetWeakPtr()));
304 } 307 }
305 308
306 void ProxyMain::SetVisible(bool visible) { 309 void ProxyMain::SetVisible(bool visible) {
307 TRACE_EVENT1("cc", "ProxyMain::SetVisible", "visible", visible); 310 TRACE_EVENT1("cc", "ProxyMain::SetVisible", "visible", visible);
308 ImplThreadTaskRunner()->PostTask( 311 ImplThreadTaskRunner()->PostTask(
309 FROM_HERE, base::BindOnce(&ProxyImpl::SetVisibleOnImpl, 312 FROM_HERE, base::BindOnce(&ProxyImpl::SetVisibleOnImpl,
310 base::Unretained(proxy_impl_.get()), visible)); 313 base::Unretained(proxy_impl_.get()), visible));
311 } 314 }
312 315
313 void ProxyMain::SetNeedsAnimate() { 316 void ProxyMain::SetNeedsAnimate() {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 base::BindOnce(&ProxyImpl::MainFrameWillHappenOnImplForTesting, 475 base::BindOnce(&ProxyImpl::MainFrameWillHappenOnImplForTesting,
473 base::Unretained(proxy_impl_.get()), &completion, 476 base::Unretained(proxy_impl_.get()), &completion,
474 &main_frame_will_happen)); 477 &main_frame_will_happen));
475 completion.Wait(); 478 completion.Wait();
476 } 479 }
477 return main_frame_will_happen; 480 return main_frame_will_happen;
478 } 481 }
479 482
480 void ProxyMain::ReleaseCompositorFrameSink() { 483 void ProxyMain::ReleaseCompositorFrameSink() {
481 DCHECK(IsMainThread()); 484 DCHECK(IsMainThread());
485 frame_sink_bound_weak_factory_.InvalidateWeakPtrs();
482 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); 486 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
483 CompletionEvent completion; 487 CompletionEvent completion;
484 ImplThreadTaskRunner()->PostTask( 488 ImplThreadTaskRunner()->PostTask(
485 FROM_HERE, 489 FROM_HERE,
486 base::BindOnce(&ProxyImpl::ReleaseCompositorFrameSinkOnImpl, 490 base::BindOnce(&ProxyImpl::ReleaseCompositorFrameSinkOnImpl,
487 base::Unretained(proxy_impl_.get()), &completion)); 491 base::Unretained(proxy_impl_.get()), &completion));
488 completion.Wait(); 492 completion.Wait();
489 } 493 }
490 494
491 void ProxyMain::UpdateBrowserControlsState(BrowserControlsState constraints, 495 void ProxyMain::UpdateBrowserControlsState(BrowserControlsState constraints,
(...skipping 27 matching lines...) Expand all
519 523
520 bool ProxyMain::IsImplThread() const { 524 bool ProxyMain::IsImplThread() const {
521 return task_runner_provider_->IsImplThread(); 525 return task_runner_provider_->IsImplThread();
522 } 526 }
523 527
524 base::SingleThreadTaskRunner* ProxyMain::ImplThreadTaskRunner() { 528 base::SingleThreadTaskRunner* ProxyMain::ImplThreadTaskRunner() {
525 return task_runner_provider_->ImplThreadTaskRunner(); 529 return task_runner_provider_->ImplThreadTaskRunner();
526 } 530 }
527 531
528 } // namespace cc 532 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698