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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 begin_impl_frame_args_.interval <= base::TimeDelta()) | 292 begin_impl_frame_args_.interval <= base::TimeDelta()) |
293 return base::TimeTicks(); | 293 return base::TimeTicks(); |
294 | 294 |
295 base::TimeTicks now = Now(); | 295 base::TimeTicks now = Now(); |
296 base::TimeTicks timebase = std::max(begin_impl_frame_args_.frame_time, | 296 base::TimeTicks timebase = std::max(begin_impl_frame_args_.frame_time, |
297 begin_impl_frame_args_.deadline); | 297 begin_impl_frame_args_.deadline); |
298 int64 intervals = 1 + ((now - timebase) / begin_impl_frame_args_.interval); | 298 int64 intervals = 1 + ((now - timebase) / begin_impl_frame_args_.interval); |
299 return timebase + (begin_impl_frame_args_.interval * intervals); | 299 return timebase + (begin_impl_frame_args_.interval * intervals); |
300 } | 300 } |
301 | 301 |
302 base::TimeTicks Scheduler::LastBeginImplFrameTime() { | 302 base::TimeTicks Scheduler::LastBeginImplFrameTime() const { |
303 return begin_impl_frame_args_.frame_time; | 303 return begin_impl_frame_args_.frame_time; |
304 } | 304 } |
305 | 305 |
306 base::TimeTicks Scheduler::NextBeginImplFrameTimeIfRequested() const { | |
mithro-old
2015/03/11 04:01:32
Why do you need this method?
vmpstr
2015/03/16 18:36:43
This returns the next predicted raf time which is
mithro-old
2015/03/20 02:17:53
Can you link me to why you need this? I was pretty
vmpstr
2015/03/20 18:47:25
The spec I'm working off is here: http://w3c.githu
mithro-old
2015/03/23 00:15:07
Reading the spec, my understanding is that you sho
| |
307 return begin_impl_frame_args_.frame_time + begin_impl_frame_args_.interval; | |
308 } | |
309 | |
306 void Scheduler::SetupNextBeginFrameIfNeeded() { | 310 void Scheduler::SetupNextBeginFrameIfNeeded() { |
307 if (!task_runner_.get()) | 311 if (!task_runner_.get()) |
308 return; | 312 return; |
309 | 313 |
310 if (state_machine_.ShouldSetNeedsBeginFrames( | 314 if (state_machine_.ShouldSetNeedsBeginFrames( |
311 frame_source_->NeedsBeginFrames())) { | 315 frame_source_->NeedsBeginFrames())) { |
312 frame_source_->SetNeedsBeginFrames(state_machine_.BeginFrameNeeded()); | 316 frame_source_->SetNeedsBeginFrames(state_machine_.BeginFrameNeeded()); |
313 if (!frame_source_->NeedsBeginFrames()) { | 317 if (!frame_source_->NeedsBeginFrames()) { |
314 client_->SendBeginMainFrameNotExpectedSoon(); | 318 client_->SendBeginMainFrameNotExpectedSoon(); |
315 } | 319 } |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
870 } | 874 } |
871 | 875 |
872 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 876 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
873 return (state_machine_.commit_state() == | 877 return (state_machine_.commit_state() == |
874 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 878 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
875 state_machine_.commit_state() == | 879 state_machine_.commit_state() == |
876 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 880 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
877 } | 881 } |
878 | 882 |
879 } // namespace cc | 883 } // namespace cc |
OLD | NEW |