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

Unified Diff: cc/scheduler/scheduler.cc

Issue 845393002: cc: Create ProxyBeginFrameSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 11 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/scheduler/scheduler.cc
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index b92b8a515b705c4a55ef5cb13a5e5479c03ec3d7..bc79776b83b4dbf1cdb1f56b833bb47e2bac6c17 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -80,6 +80,7 @@ Scheduler::Scheduler(
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
base::PowerMonitor* power_monitor,
scoped_ptr<BeginFrameSource> external_begin_frame_source,
+ ProxyBeginFrameSource* proxy_begin_frame_source,
SchedulerFrameSourcesConstructor* frame_sources_constructor)
: frame_source_(),
primary_frame_source_(NULL),
@@ -96,6 +97,7 @@ Scheduler::Scheduler(
state_machine_(scheduler_settings),
inside_process_scheduled_actions_(false),
inside_action_(SchedulerStateMachine::ACTION_NONE),
+ proxy_begin_frame_source_(proxy_begin_frame_source),
weak_factory_(this) {
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
"Scheduler::Scheduler",
@@ -104,6 +106,11 @@ Scheduler::Scheduler(
DCHECK(client_);
DCHECK(!state_machine_.BeginFrameNeeded());
+ if (settings_.forward_begin_frames_to_children) {
+ DCHECK(proxy_begin_frame_source_);
+ proxy_begin_frame_source_->set_delegate(this);
+ }
+
begin_retro_frame_closure_ =
base::Bind(&Scheduler::BeginRetroFrame, weak_factory_.GetWeakPtr());
begin_impl_frame_deadline_closure_ = base::Bind(
@@ -139,6 +146,9 @@ Scheduler::~Scheduler() {
TeardownPowerMonitoring();
if (frame_source_->NeedsBeginFrames())
frame_source_->SetNeedsBeginFrames(false);
+
+ if (proxy_begin_frame_source_)
+ proxy_begin_frame_source_->set_delegate(nullptr);
}
base::TimeTicks Scheduler::Now() const {
@@ -413,7 +423,7 @@ bool Scheduler::OnBeginFrameMixInDelegate(const BeginFrameArgs& args) {
(client_->BeginMainFrameToCommitDurationEstimate() +
client_->CommitToActivateDurationEstimate() +
client_->DrawDurationEstimate() + EstimatedParentDrawTime());
- client_->SendBeginFramesToChildren(adjusted_args_for_children);
+ proxy_begin_frame_source_->BeginFrames(adjusted_args_for_children);
}
// We have just called SetNeedsBeginFrame(true) and the BeginFrameSource has

Powered by Google App Engine
This is Rietveld 408576698