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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 ScheduleBeginImplFrameDeadline( | 572 ScheduleBeginImplFrameDeadline( |
573 AdjustedBeginImplFrameDeadline(args, draw_duration_estimate)); | 573 AdjustedBeginImplFrameDeadline(args, draw_duration_estimate)); |
574 } | 574 } |
575 } | 575 } |
576 | 576 |
577 base::TimeTicks Scheduler::AdjustedBeginImplFrameDeadline( | 577 base::TimeTicks Scheduler::AdjustedBeginImplFrameDeadline( |
578 const BeginFrameArgs& args, | 578 const BeginFrameArgs& args, |
579 base::TimeDelta draw_duration_estimate) const { | 579 base::TimeDelta draw_duration_estimate) const { |
580 // The synchronous compositor does not post a deadline task. | 580 // The synchronous compositor does not post a deadline task. |
581 DCHECK(!settings_.using_synchronous_renderer_compositor); | 581 DCHECK(!settings_.using_synchronous_renderer_compositor); |
582 if (settings_.main_thread_should_always_be_low_latency) { | 582 if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) { |
583 // In main thread low latency mode, always start deadline early. | |
584 return base::TimeTicks(); | |
585 } else if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) { | |
586 // We are ready to draw a new active tree immediately. | 583 // We are ready to draw a new active tree immediately. |
587 // We don't use Now() here because it's somewhat expensive to call. | 584 // We don't use Now() here because it's somewhat expensive to call. |
588 return base::TimeTicks(); | 585 return base::TimeTicks(); |
589 } else if (settings_.main_thread_should_always_be_low_latency) { | 586 } else if (settings_.main_thread_should_always_be_low_latency) { |
590 // Post long deadline to keep advancing during idle period. After activation | 587 // Post long deadline to keep advancing during idle period. After activation |
591 // we will be able to trigger deadline early. | 588 // we will be able to trigger deadline early. |
592 // TODO(weiliangc): Don't post deadline once input is deferred with | 589 // TODO(weiliangc): Don't post deadline once input is deferred with |
593 // BeginRetroFrames. | 590 // BeginRetroFrames. |
594 return args.frame_time + args.interval; | 591 return args.frame_time + args.interval; |
595 } else if (state_machine_.needs_redraw()) { | 592 } else if (state_machine_.needs_redraw()) { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 } | 800 } |
804 | 801 |
805 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 802 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
806 return (state_machine_.commit_state() == | 803 return (state_machine_.commit_state() == |
807 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 804 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
808 state_machine_.commit_state() == | 805 state_machine_.commit_state() == |
809 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 806 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
810 } | 807 } |
811 | 808 |
812 } // namespace cc | 809 } // namespace cc |
OLD | NEW |