Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 begin_impl_frame_args_.interval <= base::TimeDelta()) | 317 begin_impl_frame_args_.interval <= base::TimeDelta()) |
| 318 return base::TimeTicks(); | 318 return base::TimeTicks(); |
| 319 | 319 |
| 320 base::TimeTicks now = Now(); | 320 base::TimeTicks now = Now(); |
| 321 base::TimeTicks timebase = std::max(begin_impl_frame_args_.frame_time, | 321 base::TimeTicks timebase = std::max(begin_impl_frame_args_.frame_time, |
| 322 begin_impl_frame_args_.deadline); | 322 begin_impl_frame_args_.deadline); |
| 323 int64 intervals = 1 + ((now - timebase) / begin_impl_frame_args_.interval); | 323 int64 intervals = 1 + ((now - timebase) / begin_impl_frame_args_.interval); |
| 324 return timebase + (begin_impl_frame_args_.interval * intervals); | 324 return timebase + (begin_impl_frame_args_.interval * intervals); |
| 325 } | 325 } |
| 326 | 326 |
| 327 base::TimeTicks Scheduler::LastBeginImplFrameTime() { | 327 base::TimeTicks Scheduler::LastBeginImplFrameTime() const { |
| 328 return begin_impl_frame_args_.frame_time; | 328 return begin_impl_frame_args_.frame_time; |
| 329 } | 329 } |
| 330 | 330 |
| 331 base::TimeTicks Scheduler::NextBeginImplFrameTimeIfRequested() const { | |
| 332 return begin_impl_frame_args_.frame_time + begin_impl_frame_args_.interval; | |
|
vmpstr
2015/02/11 22:42:49
+brianderson, you mentioned that this might not be
| |
| 333 } | |
| 334 | |
| 331 void Scheduler::SetupNextBeginFrameIfNeeded() { | 335 void Scheduler::SetupNextBeginFrameIfNeeded() { |
| 332 if (!task_runner_.get()) | 336 if (!task_runner_.get()) |
| 333 return; | 337 return; |
| 334 | 338 |
| 335 if (state_machine_.ShouldSetNeedsBeginFrames( | 339 if (state_machine_.ShouldSetNeedsBeginFrames( |
| 336 frame_source_->NeedsBeginFrames())) { | 340 frame_source_->NeedsBeginFrames())) { |
| 337 frame_source_->SetNeedsBeginFrames(state_machine_.BeginFrameNeeded()); | 341 frame_source_->SetNeedsBeginFrames(state_machine_.BeginFrameNeeded()); |
| 338 } | 342 } |
| 339 | 343 |
| 340 if (state_machine_.begin_impl_frame_state() == | 344 if (state_machine_.begin_impl_frame_state() == |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 818 } | 822 } |
| 819 | 823 |
| 820 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 824 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 821 return (state_machine_.commit_state() == | 825 return (state_machine_.commit_state() == |
| 822 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 826 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
| 823 state_machine_.commit_state() == | 827 state_machine_.commit_state() == |
| 824 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 828 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
| 825 } | 829 } |
| 826 | 830 |
| 827 } // namespace cc | 831 } // namespace cc |
| OLD | NEW |