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

Unified Diff: cc/scheduler/scheduler.cc

Issue 775143003: cc: Implement unified BeginFrame on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unittest Created 5 years, 9 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 904a0574515dac727b021f59386a721a0bb2f3c7..7fb1e5967deab82c99d784691febe5e746a3720e 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -87,6 +87,8 @@ Scheduler::Scheduler(
primary_frame_source_internal_(external_begin_frame_source.Pass()),
background_frame_source_internal_(),
vsync_observer_(NULL),
+ authoritative_vsync_interval_(base::TimeDelta()),
+ last_vsync_timebase_(base::TimeTicks()),
throttle_frame_production_(scheduler_settings.throttle_frame_production),
settings_(scheduler_settings),
client_(client),
@@ -173,9 +175,14 @@ void Scheduler::OnPowerStateChange(bool on_battery_power) {
void Scheduler::CommitVSyncParameters(base::TimeTicks timebase,
base::TimeDelta interval) {
- // TODO(brianderson): We should not be receiving 0 intervals.
- if (interval == base::TimeDelta())
+ if (authoritative_vsync_interval_ != base::TimeDelta()) {
+ interval = authoritative_vsync_interval_;
+ } else if (interval == base::TimeDelta()) {
+ // TODO(brianderson): We should not be receiving 0 intervals.
interval = BeginFrameArgs::DefaultInterval();
+ }
+
+ last_vsync_timebase_ = timebase;
if (vsync_observer_)
vsync_observer_->OnUpdateVSyncParameters(timebase, interval);
@@ -405,8 +412,7 @@ bool Scheduler::OnBeginFrameMixInDelegate(const BeginFrameArgs& args) {
TRACE_EVENT1("cc,benchmark", "Scheduler::BeginFrame", "args", args.AsValue());
// Deliver BeginFrames to children.
- if (settings_.forward_begin_frames_to_children &&
- state_machine_.children_need_begin_frames()) {
+ if (state_machine_.children_need_begin_frames()) {
BeginFrameArgs adjusted_args_for_children(args);
// Adjust a deadline for child schedulers.
// TODO(simonhong): Once we have commitless update, we can get rid of
@@ -456,11 +462,16 @@ bool Scheduler::OnBeginFrameMixInDelegate(const BeginFrameArgs& args) {
}
void Scheduler::SetChildrenNeedBeginFrames(bool children_need_begin_frames) {
- DCHECK(settings_.forward_begin_frames_to_children);
state_machine_.SetChildrenNeedBeginFrames(children_need_begin_frames);
ProcessScheduledActions();
}
+void Scheduler::SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) {
+ authoritative_vsync_interval_ = interval;
+ if (vsync_observer_)
+ vsync_observer_->OnUpdateVSyncParameters(last_vsync_timebase_, interval);
+}
+
// BeginRetroFrame is called for BeginFrames that we've deferred because
// the scheduler was in the middle of processing a previous BeginFrame.
void Scheduler::BeginRetroFrame() {

Powered by Google App Engine
This is Rietveld 408576698