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

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

Issue 638653003: Make ui::Compositor use ui::Scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments to add helpful temp variable Created 6 years 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 void SingleThreadProxy::SetLayerTreeHostClientReady() { 84 void SingleThreadProxy::SetLayerTreeHostClientReady() {
85 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady"); 85 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady");
86 // Scheduling is controlled by the embedder in the single thread case, so 86 // Scheduling is controlled by the embedder in the single thread case, so
87 // nothing to do. 87 // nothing to do.
88 DCHECK(Proxy::IsMainThread()); 88 DCHECK(Proxy::IsMainThread());
89 DebugScopedSetImplThread impl(this); 89 DebugScopedSetImplThread impl(this);
90 if (layer_tree_host_->settings().single_thread_proxy_scheduler && 90 if (layer_tree_host_->settings().single_thread_proxy_scheduler &&
91 !scheduler_on_impl_thread_) { 91 !scheduler_on_impl_thread_) {
92 SchedulerSettings scheduler_settings(layer_tree_host_->settings()); 92 SchedulerSettings scheduler_settings(layer_tree_host_->settings());
93 // SingleThreadProxy should run in main thread low latency mode.
94 scheduler_settings.main_thread_should_always_be_low_latency = true;
93 scheduler_on_impl_thread_ = 95 scheduler_on_impl_thread_ =
94 Scheduler::Create(this, 96 Scheduler::Create(this,
95 scheduler_settings, 97 scheduler_settings,
96 layer_tree_host_->id(), 98 layer_tree_host_->id(),
97 MainThreadTaskRunner(), 99 MainThreadTaskRunner(),
98 base::PowerMonitor::Get(), 100 base::PowerMonitor::Get(),
99 external_begin_frame_source_.Pass()); 101 external_begin_frame_source_.Pass());
100 scheduler_on_impl_thread_->SetCanStart(); 102 scheduler_on_impl_thread_->SetCanStart();
101 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); 103 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
102 } 104 }
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } 420 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; }
419 421
420 void SingleThreadProxy::DidActivateSyncTree() { 422 void SingleThreadProxy::DidActivateSyncTree() {
421 // Non-impl-side painting finishes commit in DoCommit. Impl-side painting 423 // Non-impl-side painting finishes commit in DoCommit. Impl-side painting
422 // defers until here to simulate SetNextCommitWaitsForActivation. 424 // defers until here to simulate SetNextCommitWaitsForActivation.
423 if (layer_tree_host_impl_->settings().impl_side_painting) { 425 if (layer_tree_host_impl_->settings().impl_side_painting) {
424 // This is required because NotifyReadyToActivate gets called when 426 // This is required because NotifyReadyToActivate gets called when
425 // the pending tree is not actually ready in the SingleThreadProxy. 427 // the pending tree is not actually ready in the SingleThreadProxy.
426 layer_tree_host_impl_->SetRequiresHighResToDraw(); 428 layer_tree_host_impl_->SetRequiresHighResToDraw();
427 429
428 // Since activation could cause tasks to run, post CommitComplete 430 // Synchronously call to CommitComplete. Resetting
429 // separately so that it runs after these tasks. This is the loose 431 // commit_blocking_task_runner would make sure all tasks posted during
danakj 2014/12/04 22:22:10 nit: |commit_blocking_task_runner_|
430 // equivalent of blocking commit until activation and also running 432 // commit/activation before CommitComplete.
431 // all tasks posted during commit/activation before CommitComplete. 433 CommitComplete();
432 MainThreadTaskRunner()->PostTask(
433 FROM_HERE, base::Bind(&SingleThreadProxy::CommitComplete,
434 weak_factory_.GetWeakPtr()));
435 } 434 }
436 435
437 timing_history_.DidActivateSyncTree(); 436 timing_history_.DidActivateSyncTree();
438 } 437 }
439 438
440 void SingleThreadProxy::DidManageTiles() { 439 void SingleThreadProxy::DidManageTiles() {
441 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); 440 DCHECK(layer_tree_host_impl_->settings().impl_side_painting);
442 DCHECK(Proxy::IsImplThread()); 441 DCHECK(Proxy::IsImplThread());
443 if (scheduler_on_impl_thread_) 442 if (scheduler_on_impl_thread_)
444 scheduler_on_impl_thread_->DidManageTiles(); 443 scheduler_on_impl_thread_->DidManageTiles();
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 793
795 void SingleThreadProxy::DidBeginImplFrameDeadline() { 794 void SingleThreadProxy::DidBeginImplFrameDeadline() {
796 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); 795 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
797 } 796 }
798 797
799 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { 798 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) {
800 layer_tree_host_->SendBeginFramesToChildren(args); 799 layer_tree_host_->SendBeginFramesToChildren(args);
801 } 800 }
802 801
803 } // namespace cc 802 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698