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