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/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 !has_pending_tree_) | 946 !has_pending_tree_) |
947 return true; | 947 return true; |
948 | 948 |
949 // Prioritize impl-thread draws in ImplLatencyTakesPriority mode. | 949 // Prioritize impl-thread draws in ImplLatencyTakesPriority mode. |
950 if (ImplLatencyTakesPriority()) | 950 if (ImplLatencyTakesPriority()) |
951 return true; | 951 return true; |
952 | 952 |
953 return false; | 953 return false; |
954 } | 954 } |
955 | 955 |
956 bool SchedulerStateMachine::main_thread_missed_last_deadline() const { | |
957 return main_thread_missed_last_deadline_; | |
958 } | |
959 | |
960 bool SchedulerStateMachine::SwapThrottled() const { | 956 bool SchedulerStateMachine::SwapThrottled() const { |
961 return pending_swaps_ >= kMaxPendingSwaps; | 957 return pending_swaps_ >= kMaxPendingSwaps; |
962 } | 958 } |
963 | 959 |
964 void SchedulerStateMachine::SetVisible(bool visible) { | 960 void SchedulerStateMachine::SetVisible(bool visible) { |
965 if (visible_ == visible) | 961 if (visible_ == visible) |
966 return; | 962 return; |
967 | 963 |
968 visible_ = visible; | 964 visible_ = visible; |
969 | 965 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT; | 1057 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT; |
1062 // In commit_to_active_tree mode, commit should happen right after | 1058 // In commit_to_active_tree mode, commit should happen right after |
1063 // BeginFrame, meaning when this function is called, next action should be | 1059 // BeginFrame, meaning when this function is called, next action should be |
1064 // commit. | 1060 // commit. |
1065 if (settings_.commit_to_active_tree) | 1061 if (settings_.commit_to_active_tree) |
1066 DCHECK(ShouldCommit()); | 1062 DCHECK(ShouldCommit()); |
1067 } | 1063 } |
1068 | 1064 |
1069 void SchedulerStateMachine::BeginMainFrameAborted(CommitEarlyOutReason reason) { | 1065 void SchedulerStateMachine::BeginMainFrameAborted(CommitEarlyOutReason reason) { |
1070 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED); | 1066 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED); |
| 1067 |
| 1068 // If the main thread aborted, it doesn't matter if the main thread missed |
| 1069 // the last deadline since it didn't have an update anyway. |
| 1070 main_thread_missed_last_deadline_ = false; |
| 1071 |
1071 switch (reason) { | 1072 switch (reason) { |
1072 case CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST: | 1073 case CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST: |
1073 case CommitEarlyOutReason::ABORTED_NOT_VISIBLE: | 1074 case CommitEarlyOutReason::ABORTED_NOT_VISIBLE: |
1074 case CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT: | 1075 case CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT: |
1075 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; | 1076 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; |
1076 SetNeedsBeginMainFrame(); | 1077 SetNeedsBeginMainFrame(); |
1077 return; | 1078 return; |
1078 case CommitEarlyOutReason::FINISHED_NO_UPDATES: | 1079 case CommitEarlyOutReason::FINISHED_NO_UPDATES: |
1079 bool commit_has_no_updates = true; | 1080 bool commit_has_no_updates = true; |
1080 WillCommit(commit_has_no_updates); | 1081 WillCommit(commit_has_no_updates); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 case OUTPUT_SURFACE_ACTIVE: | 1136 case OUTPUT_SURFACE_ACTIVE: |
1136 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1137 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
1137 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1138 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
1138 return true; | 1139 return true; |
1139 } | 1140 } |
1140 NOTREACHED(); | 1141 NOTREACHED(); |
1141 return false; | 1142 return false; |
1142 } | 1143 } |
1143 | 1144 |
1144 } // namespace cc | 1145 } // namespace cc |
OLD | NEW |