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

Side by Side Diff: cc/scheduler/scheduler.cc

Issue 1012853003: Add DisplayScheduler for Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include dependent patch for trybots Created 5 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 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/scheduler/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 base::TimeTicks Scheduler::Now() const { 122 base::TimeTicks Scheduler::Now() const {
123 base::TimeTicks now = gfx::FrameTime::Now(); 123 base::TimeTicks now = gfx::FrameTime::Now();
124 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.now"), 124 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.now"),
125 "Scheduler::Now", 125 "Scheduler::Now",
126 "now", 126 "now",
127 now); 127 now);
128 return now; 128 return now;
129 } 129 }
130 130
131 void Scheduler::SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) {
132 authoritative_vsync_interval_ = interval;
133 if (vsync_observer_)
134 vsync_observer_->OnUpdateVSyncParameters(last_vsync_timebase_, interval);
135 }
136
131 void Scheduler::CommitVSyncParameters(base::TimeTicks timebase, 137 void Scheduler::CommitVSyncParameters(base::TimeTicks timebase,
132 base::TimeDelta interval) { 138 base::TimeDelta interval) {
139 TRACE_EVENT2("cc", "Scheduler::CommitVSyncParameters", "timebase",
140 (timebase - base::TimeTicks()).InSecondsF(), "interval",
141 interval.InSecondsF());
142
133 if (authoritative_vsync_interval_ != base::TimeDelta()) { 143 if (authoritative_vsync_interval_ != base::TimeDelta()) {
134 interval = authoritative_vsync_interval_; 144 interval = authoritative_vsync_interval_;
135 } else if (interval == base::TimeDelta()) { 145 } else if (interval == base::TimeDelta()) {
136 // TODO(brianderson): We should not be receiving 0 intervals. 146 // TODO(brianderson): We should not be receiving 0 intervals.
137 interval = BeginFrameArgs::DefaultInterval(); 147 interval = BeginFrameArgs::DefaultInterval();
138 } 148 }
139 149
140 last_vsync_timebase_ = timebase; 150 last_vsync_timebase_ = timebase;
141 151
142 if (vsync_observer_) 152 if (vsync_observer_)
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 BeginImplFrameWithDeadline(adjusted_args); 397 BeginImplFrameWithDeadline(adjusted_args);
388 } 398 }
389 return true; 399 return true;
390 } 400 }
391 401
392 void Scheduler::SetChildrenNeedBeginFrames(bool children_need_begin_frames) { 402 void Scheduler::SetChildrenNeedBeginFrames(bool children_need_begin_frames) {
393 state_machine_.SetChildrenNeedBeginFrames(children_need_begin_frames); 403 state_machine_.SetChildrenNeedBeginFrames(children_need_begin_frames);
394 ProcessScheduledActions(); 404 ProcessScheduledActions();
395 } 405 }
396 406
397 void Scheduler::SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) {
398 authoritative_vsync_interval_ = interval;
399 if (vsync_observer_)
400 vsync_observer_->OnUpdateVSyncParameters(last_vsync_timebase_, interval);
401 }
402
403 void Scheduler::OnDrawForOutputSurface() { 407 void Scheduler::OnDrawForOutputSurface() {
404 DCHECK(settings_.using_synchronous_renderer_compositor); 408 DCHECK(settings_.using_synchronous_renderer_compositor);
405 DCHECK_EQ(state_machine_.begin_impl_frame_state(), 409 DCHECK_EQ(state_machine_.begin_impl_frame_state(),
406 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); 410 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
407 DCHECK(!BeginImplFrameDeadlinePending()); 411 DCHECK(!BeginImplFrameDeadlinePending());
408 412
409 state_machine_.OnBeginImplFrameDeadline(); 413 state_machine_.OnBeginImplFrameDeadline();
410 ProcessScheduledActions(); 414 ProcessScheduledActions();
411 415
412 state_machine_.OnBeginImplFrameIdle(); 416 state_machine_.OnBeginImplFrameIdle();
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 828 }
825 829
826 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 830 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
827 return (state_machine_.commit_state() == 831 return (state_machine_.commit_state() ==
828 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || 832 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT ||
829 state_machine_.commit_state() == 833 state_machine_.commit_state() ==
830 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); 834 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED);
831 } 835 }
832 836
833 } // namespace cc 837 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698