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 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/debug/trace_event_argument.h" | 10 #include "base/debug/trace_event_argument.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 | 451 |
452 // Discard expired BeginRetroFrames | 452 // Discard expired BeginRetroFrames |
453 // Today, we should always end up with at most one un-expired BeginRetroFrame | 453 // Today, we should always end up with at most one un-expired BeginRetroFrame |
454 // because deadlines will not be greater than the next frame time. We don't | 454 // because deadlines will not be greater than the next frame time. We don't |
455 // DCHECK though because some systems don't always have monotonic timestamps. | 455 // DCHECK though because some systems don't always have monotonic timestamps. |
456 // TODO(brianderson): In the future, long deadlines could result in us not | 456 // TODO(brianderson): In the future, long deadlines could result in us not |
457 // draining the queue if we don't catch up. If we consistently can't catch | 457 // draining the queue if we don't catch up. If we consistently can't catch |
458 // up, our fallback should be to lower our frame rate. | 458 // up, our fallback should be to lower our frame rate. |
459 base::TimeTicks now = Now(); | 459 base::TimeTicks now = Now(); |
460 base::TimeDelta draw_duration_estimate = client_->DrawDurationEstimate(); | 460 base::TimeDelta draw_duration_estimate = client_->DrawDurationEstimate(); |
461 while (!begin_retro_frame_args_.empty() && | 461 while (!begin_retro_frame_args_.empty()) { |
462 now > AdjustedBeginImplFrameDeadline(begin_retro_frame_args_.front(), | 462 base::TimeTicks adjusted_deadline = AdjustedBeginImplFrameDeadline( |
463 draw_duration_estimate)) { | 463 begin_retro_frame_args_.front(), draw_duration_estimate); |
464 TRACE_EVENT1("cc", | 464 if (now < adjusted_deadline) |
Sami
2014/09/18 10:22:34
nit: This should be "<=" to match the previous beh
| |
465 "Scheduler::BeginRetroFrame discarding", | 465 break; |
466 "frame_time", | 466 |
467 begin_retro_frame_args_.front().frame_time); | 467 TRACE_EVENT_INSTANT2("cc", |
468 "Scheduler::BeginRetroFrame discarding", | |
469 TRACE_EVENT_SCOPE_THREAD, | |
470 "deadline - now", | |
471 (adjusted_deadline - now).InMicroseconds(), | |
472 "BeginFrameArgs", | |
473 begin_retro_frame_args_.front().AsValue()); | |
468 begin_retro_frame_args_.pop_front(); | 474 begin_retro_frame_args_.pop_front(); |
469 } | 475 } |
470 | 476 |
471 if (begin_retro_frame_args_.empty()) { | 477 if (begin_retro_frame_args_.empty()) { |
472 DCHECK(settings_.throttle_frame_production); | 478 DCHECK(settings_.throttle_frame_production); |
473 TRACE_EVENT_INSTANT0("cc", | 479 TRACE_EVENT_INSTANT0("cc", |
474 "Scheduler::BeginRetroFrames all expired", | 480 "Scheduler::BeginRetroFrames all expired", |
475 TRACE_EVENT_SCOPE_THREAD); | 481 TRACE_EVENT_SCOPE_THREAD); |
476 } else { | 482 } else { |
477 BeginImplFrame(begin_retro_frame_args_.front()); | 483 BeginImplFrame(begin_retro_frame_args_.front()); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
767 } | 773 } |
768 | 774 |
769 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 775 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
770 return (state_machine_.commit_state() == | 776 return (state_machine_.commit_state() == |
771 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 777 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
772 state_machine_.commit_state() == | 778 state_machine_.commit_state() == |
773 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 779 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
774 } | 780 } |
775 | 781 |
776 } // namespace cc | 782 } // namespace cc |
OLD | NEW |