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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 begin_impl_frame_args_.interval <= base::TimeDelta()) | 318 begin_impl_frame_args_.interval <= base::TimeDelta()) |
319 return base::TimeTicks(); | 319 return base::TimeTicks(); |
320 | 320 |
321 base::TimeTicks now = Now(); | 321 base::TimeTicks now = Now(); |
322 base::TimeTicks timebase = std::max(begin_impl_frame_args_.frame_time, | 322 base::TimeTicks timebase = std::max(begin_impl_frame_args_.frame_time, |
323 begin_impl_frame_args_.deadline); | 323 begin_impl_frame_args_.deadline); |
324 int64 intervals = 1 + ((now - timebase) / begin_impl_frame_args_.interval); | 324 int64 intervals = 1 + ((now - timebase) / begin_impl_frame_args_.interval); |
325 return timebase + (begin_impl_frame_args_.interval * intervals); | 325 return timebase + (begin_impl_frame_args_.interval * intervals); |
326 } | 326 } |
327 | 327 |
328 base::TimeTicks Scheduler::LastBeginImplFrameTime() { | 328 base::TimeTicks Scheduler::LastBeginImplFrameTime() const { |
329 return begin_impl_frame_args_.frame_time; | 329 return begin_impl_frame_args_.frame_time; |
330 } | 330 } |
331 | 331 |
| 332 base::TimeTicks Scheduler::NextBeginImplFrameTimeIfRequested() const { |
| 333 return begin_impl_frame_args_.frame_time + begin_impl_frame_args_.interval; |
| 334 } |
| 335 |
332 void Scheduler::SetupNextBeginFrameIfNeeded() { | 336 void Scheduler::SetupNextBeginFrameIfNeeded() { |
333 if (!task_runner_.get()) | 337 if (!task_runner_.get()) |
334 return; | 338 return; |
335 | 339 |
336 if (state_machine_.ShouldSetNeedsBeginFrames( | 340 if (state_machine_.ShouldSetNeedsBeginFrames( |
337 frame_source_->NeedsBeginFrames())) { | 341 frame_source_->NeedsBeginFrames())) { |
338 frame_source_->SetNeedsBeginFrames(state_machine_.BeginFrameNeeded()); | 342 frame_source_->SetNeedsBeginFrames(state_machine_.BeginFrameNeeded()); |
339 if (!frame_source_->NeedsBeginFrames()) { | 343 if (!frame_source_->NeedsBeginFrames()) { |
340 client_->SendBeginMainFrameNotExpectedSoon(); | 344 client_->SendBeginMainFrameNotExpectedSoon(); |
341 } | 345 } |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 } | 900 } |
897 | 901 |
898 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 902 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
899 return (state_machine_.commit_state() == | 903 return (state_machine_.commit_state() == |
900 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 904 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
901 state_machine_.commit_state() == | 905 state_machine_.commit_state() == |
902 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 906 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
903 } | 907 } |
904 | 908 |
905 } // namespace cc | 909 } // namespace cc |
OLD | NEW |