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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 needs_begin_main_frame_ = true; | 1018 needs_begin_main_frame_ = true; |
1019 break; | 1019 break; |
1020 } | 1020 } |
1021 } | 1021 } |
1022 | 1022 |
1023 void SchedulerStateMachine::SetNeedsBeginMainFrame() { | 1023 void SchedulerStateMachine::SetNeedsBeginMainFrame() { |
1024 needs_begin_main_frame_ = true; | 1024 needs_begin_main_frame_ = true; |
1025 } | 1025 } |
1026 | 1026 |
1027 void SchedulerStateMachine::NotifyReadyToCommit() { | 1027 void SchedulerStateMachine::NotifyReadyToCommit() { |
1028 DCHECK(begin_main_frame_state_ == BEGIN_MAIN_FRAME_STATE_STARTED) | 1028 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED) |
1029 << AsValue()->ToString(); | 1029 << AsValue()->ToString(); |
1030 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT; | 1030 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT; |
1031 // In commit_to_active_tree mode, commit should happen right after | 1031 // In commit_to_active_tree mode, commit should happen right after |
1032 // BeginFrame, meaning when this function is called, next action should be | 1032 // BeginFrame, meaning when this function is called, next action should be |
1033 // commit. | 1033 // commit. |
1034 if (settings_.commit_to_active_tree) | 1034 if (settings_.commit_to_active_tree) |
1035 DCHECK(ShouldCommit()); | 1035 DCHECK(ShouldCommit()); |
1036 } | 1036 } |
1037 | 1037 |
1038 void SchedulerStateMachine::BeginMainFrameAborted(CommitEarlyOutReason reason) { | 1038 void SchedulerStateMachine::BeginMainFrameAborted(CommitEarlyOutReason reason) { |
1039 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_SENT); | 1039 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED); |
1040 switch (reason) { | 1040 switch (reason) { |
1041 case CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST: | 1041 case CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST: |
1042 case CommitEarlyOutReason::ABORTED_NOT_VISIBLE: | 1042 case CommitEarlyOutReason::ABORTED_NOT_VISIBLE: |
1043 case CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT: | 1043 case CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT: |
1044 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; | 1044 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; |
1045 SetNeedsBeginMainFrame(); | 1045 SetNeedsBeginMainFrame(); |
1046 return; | 1046 return; |
1047 case CommitEarlyOutReason::FINISHED_NO_UPDATES: | 1047 case CommitEarlyOutReason::FINISHED_NO_UPDATES: |
1048 bool commit_has_no_updates = true; | 1048 bool commit_has_no_updates = true; |
1049 WillCommit(commit_has_no_updates); | 1049 WillCommit(commit_has_no_updates); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 case OUTPUT_SURFACE_ACTIVE: | 1104 case OUTPUT_SURFACE_ACTIVE: |
1105 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1105 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
1106 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1106 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
1107 return true; | 1107 return true; |
1108 } | 1108 } |
1109 NOTREACHED(); | 1109 NOTREACHED(); |
1110 return false; | 1110 return false; |
1111 } | 1111 } |
1112 | 1112 |
1113 } // namespace cc | 1113 } // namespace cc |
OLD | NEW |