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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // Today, we should always end up with at most one un-expired BeginRetroFrame | 430 // Today, we should always end up with at most one un-expired BeginRetroFrame |
431 // because deadlines will not be greater than the next frame time. We don't | 431 // because deadlines will not be greater than the next frame time. We don't |
432 // DCHECK though because some systems don't always have monotonic timestamps. | 432 // DCHECK though because some systems don't always have monotonic timestamps. |
433 // TODO(brianderson): In the future, long deadlines could result in us not | 433 // TODO(brianderson): In the future, long deadlines could result in us not |
434 // draining the queue if we don't catch up. If we consistently can't catch | 434 // draining the queue if we don't catch up. If we consistently can't catch |
435 // up, our fallback should be to lower our frame rate. | 435 // up, our fallback should be to lower our frame rate. |
436 base::TimeTicks now = Now(); | 436 base::TimeTicks now = Now(); |
437 | 437 |
438 while (!begin_retro_frame_args_.empty()) { | 438 while (!begin_retro_frame_args_.empty()) { |
439 const BeginFrameArgs& args = begin_retro_frame_args_.front(); | 439 const BeginFrameArgs& args = begin_retro_frame_args_.front(); |
440 base::TimeTicks expiration_time = args.deadline; | 440 base::TimeTicks expiration_time = args.frame_time + args.interval; |
441 if (now <= expiration_time) | 441 if (now <= expiration_time) |
442 break; | 442 break; |
443 TRACE_EVENT_INSTANT2( | 443 TRACE_EVENT_INSTANT2( |
444 "cc", "Scheduler::BeginRetroFrame discarding", TRACE_EVENT_SCOPE_THREAD, | 444 "cc", "Scheduler::BeginRetroFrame discarding", TRACE_EVENT_SCOPE_THREAD, |
445 "expiration_time - now", (expiration_time - now).InMillisecondsF(), | 445 "expiration_time - now", (expiration_time - now).InMillisecondsF(), |
446 "BeginFrameArgs", begin_retro_frame_args_.front().AsValue()); | 446 "BeginFrameArgs", begin_retro_frame_args_.front().AsValue()); |
447 begin_retro_frame_args_.pop_front(); | 447 begin_retro_frame_args_.pop_front(); |
448 frame_source_->DidFinishFrame(begin_retro_frame_args_.size()); | 448 frame_source_->DidFinishFrame(begin_retro_frame_args_.size()); |
449 } | 449 } |
450 | 450 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 } | 825 } |
826 | 826 |
827 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 827 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
828 return (state_machine_.commit_state() == | 828 return (state_machine_.commit_state() == |
829 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 829 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
830 state_machine_.commit_state() == | 830 state_machine_.commit_state() == |
831 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 831 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
832 } | 832 } |
833 | 833 |
834 } // namespace cc | 834 } // namespace cc |
OLD | NEW |