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_state_machine.h" | 5 #include "cc/scheduler/scheduler_state_machine.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/debug/trace_event_argument.h" | 8 #include "base/debug/trace_event_argument.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 << AsValue()->ToString(); | 813 << AsValue()->ToString(); |
814 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE; | 814 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE; |
815 } | 815 } |
816 | 816 |
817 void SchedulerStateMachine::OnBeginImplFrameIdle() { | 817 void SchedulerStateMachine::OnBeginImplFrameIdle() { |
818 DCHECK_EQ(begin_impl_frame_state_, BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) | 818 DCHECK_EQ(begin_impl_frame_state_, BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) |
819 << AsValue()->ToString(); | 819 << AsValue()->ToString(); |
820 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_IDLE; | 820 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_IDLE; |
821 } | 821 } |
822 | 822 |
823 bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineEarly() const { | 823 SchedulerStateMachine::BeginImplFrameDeadlineMode |
| 824 SchedulerStateMachine::CurrentBeginImplFrameDeadlineMode() const { |
| 825 if (ShouldTriggerBeginImplFrameDeadlineImmediately()) { |
| 826 return BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE; |
| 827 } else if (needs_redraw_ && pending_swaps_ < max_pending_swaps_) { |
| 828 // We have an animation or fast input path on the impl thread that wants |
| 829 // to draw, so don't wait too long for a new active tree. |
| 830 // If we are swap throttled we should wait until we are unblocked. |
| 831 return BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR; |
| 832 } else { |
| 833 // The impl thread doesn't have anything it wants to draw and we are just |
| 834 // waiting for a new active tree or we are swap throttled. In short we are |
| 835 // blocked. |
| 836 return BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE; |
| 837 } |
| 838 } |
| 839 |
| 840 bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately() |
| 841 const { |
824 // TODO(brianderson): This should take into account multiple commit sources. | 842 // TODO(brianderson): This should take into account multiple commit sources. |
825 | 843 |
826 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) | 844 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) |
827 return false; | 845 return false; |
828 | 846 |
829 // If we've lost the output surface, end the current BeginImplFrame ASAP | 847 // If we've lost the output surface, end the current BeginImplFrame ASAP |
830 // so we can start creating the next output surface. | 848 // so we can start creating the next output surface. |
831 if (output_surface_state_ == OUTPUT_SURFACE_LOST) | 849 if (output_surface_state_ == OUTPUT_SURFACE_LOST) |
832 return true; | 850 return true; |
833 | 851 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 static_cast<int>(begin_impl_frame_state_), | 1096 static_cast<int>(begin_impl_frame_state_), |
1079 static_cast<int>(commit_state_), | 1097 static_cast<int>(commit_state_), |
1080 has_pending_tree_ ? 'T' : 'F', | 1098 has_pending_tree_ ? 'T' : 'F', |
1081 pending_tree_is_ready_for_activation_ ? 'T' : 'F', | 1099 pending_tree_is_ready_for_activation_ ? 'T' : 'F', |
1082 active_tree_needs_first_draw_ ? 'T' : 'F', | 1100 active_tree_needs_first_draw_ ? 'T' : 'F', |
1083 max_pending_swaps_, | 1101 max_pending_swaps_, |
1084 pending_swaps_); | 1102 pending_swaps_); |
1085 } | 1103 } |
1086 | 1104 |
1087 } // namespace cc | 1105 } // namespace cc |
OLD | NEW |