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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 Scheduler::AsValue() const { | 709 Scheduler::AsValue() const { |
710 std::unique_ptr<base::trace_event::TracedValue> state( | 710 std::unique_ptr<base::trace_event::TracedValue> state( |
711 new base::trace_event::TracedValue()); | 711 new base::trace_event::TracedValue()); |
712 base::TimeTicks now = Now(); | 712 base::TimeTicks now = Now(); |
713 | 713 |
714 state->BeginDictionary("state_machine"); | 714 state->BeginDictionary("state_machine"); |
715 state_machine_.AsValueInto(state.get()); | 715 state_machine_.AsValueInto(state.get()); |
716 state->EndDictionary(); | 716 state->EndDictionary(); |
717 | 717 |
718 state->BeginDictionary("scheduler_state"); | 718 state->BeginDictionary("scheduler_state"); |
719 state->SetBoolean("throttle_frame_production_", | |
720 settings_.throttle_frame_production); | |
721 state->SetDouble("estimated_parent_draw_time_ms", | 719 state->SetDouble("estimated_parent_draw_time_ms", |
722 estimated_parent_draw_time_.InMillisecondsF()); | 720 estimated_parent_draw_time_.InMillisecondsF()); |
723 state->SetBoolean("observing_begin_frame_source", | 721 state->SetBoolean("observing_begin_frame_source", |
724 observing_begin_frame_source_); | 722 observing_begin_frame_source_); |
725 state->SetInteger("begin_retro_frame_args", | 723 state->SetInteger("begin_retro_frame_args", |
726 static_cast<int>(begin_retro_frame_args_.size())); | 724 static_cast<int>(begin_retro_frame_args_.size())); |
727 state->SetBoolean("begin_retro_frame_task", | 725 state->SetBoolean("begin_retro_frame_task", |
728 !begin_retro_frame_task_.IsCancelled()); | 726 !begin_retro_frame_task_.IsCancelled()); |
729 state->SetBoolean("begin_impl_frame_deadline_task", | 727 state->SetBoolean("begin_impl_frame_deadline_task", |
730 !begin_impl_frame_deadline_task_.IsCancelled()); | 728 !begin_impl_frame_deadline_task_.IsCancelled()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 } | 769 } |
772 | 770 |
773 bool Scheduler::ShouldRecoverImplLatency( | 771 bool Scheduler::ShouldRecoverImplLatency( |
774 const BeginFrameArgs& args, | 772 const BeginFrameArgs& args, |
775 bool can_activate_before_deadline) const { | 773 bool can_activate_before_deadline) const { |
776 DCHECK(!settings_.using_synchronous_renderer_compositor); | 774 DCHECK(!settings_.using_synchronous_renderer_compositor); |
777 | 775 |
778 // Disable impl thread latency recovery when using the unthrottled | 776 // Disable impl thread latency recovery when using the unthrottled |
779 // begin frame source since we will always get a BeginFrame before | 777 // begin frame source since we will always get a BeginFrame before |
780 // the swap ack and our heuristics below will not work. | 778 // the swap ack and our heuristics below will not work. |
781 if (!settings_.throttle_frame_production) | 779 if (begin_frame_source_ && !begin_frame_source_->IsThrottled()) |
782 return false; | 780 return false; |
783 | 781 |
784 // If we are swap throttled at the BeginFrame, that means the impl thread is | 782 // If we are swap throttled at the BeginFrame, that means the impl thread is |
785 // very likely in a high latency mode. | 783 // very likely in a high latency mode. |
786 bool impl_thread_is_likely_high_latency = state_machine_.SwapThrottled(); | 784 bool impl_thread_is_likely_high_latency = state_machine_.SwapThrottled(); |
787 if (!impl_thread_is_likely_high_latency) | 785 if (!impl_thread_is_likely_high_latency) |
788 return false; | 786 return false; |
789 | 787 |
790 // The deadline may be in the past if our draw time is too long. | 788 // The deadline may be in the past if our draw time is too long. |
791 bool can_draw_before_deadline = args.frame_time < args.deadline; | 789 bool can_draw_before_deadline = args.frame_time < args.deadline; |
(...skipping 27 matching lines...) Expand all Loading... |
819 } | 817 } |
820 | 818 |
821 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 819 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
822 return (state_machine_.begin_main_frame_state() == | 820 return (state_machine_.begin_main_frame_state() == |
823 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || | 821 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || |
824 state_machine_.begin_main_frame_state() == | 822 state_machine_.begin_main_frame_state() == |
825 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); | 823 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); |
826 } | 824 } |
827 | 825 |
828 } // namespace cc | 826 } // namespace cc |
OLD | NEW |