| 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 #ifndef CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 5 #ifndef CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| 6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 BEGIN_IMPL_FRAME_DEADLINE_MODE_BLOCKED_ON_READY_TO_DRAW, | 75 BEGIN_IMPL_FRAME_DEADLINE_MODE_BLOCKED_ON_READY_TO_DRAW, |
| 76 }; | 76 }; |
| 77 static const char* BeginImplFrameDeadlineModeToString( | 77 static const char* BeginImplFrameDeadlineModeToString( |
| 78 BeginImplFrameDeadlineMode mode); | 78 BeginImplFrameDeadlineMode mode); |
| 79 | 79 |
| 80 enum BeginMainFrameState { | 80 enum BeginMainFrameState { |
| 81 BEGIN_MAIN_FRAME_STATE_IDLE, | 81 BEGIN_MAIN_FRAME_STATE_IDLE, |
| 82 BEGIN_MAIN_FRAME_STATE_SENT, | 82 BEGIN_MAIN_FRAME_STATE_SENT, |
| 83 BEGIN_MAIN_FRAME_STATE_STARTED, | 83 BEGIN_MAIN_FRAME_STATE_STARTED, |
| 84 BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT, | 84 BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT, |
| 85 BEGIN_MAIN_FRAME_STATE_WAITING_FOR_ACTIVATION, |
| 86 BEGIN_MAIN_FRAME_STATE_WAITING_FOR_DRAW, |
| 85 }; | 87 }; |
| 86 static const char* BeginMainFrameStateToString(BeginMainFrameState state); | 88 static const char* BeginMainFrameStateToString(BeginMainFrameState state); |
| 87 | 89 |
| 88 enum ForcedRedrawOnTimeoutState { | 90 enum ForcedRedrawOnTimeoutState { |
| 89 FORCED_REDRAW_STATE_IDLE, | 91 FORCED_REDRAW_STATE_IDLE, |
| 90 FORCED_REDRAW_STATE_WAITING_FOR_COMMIT, | 92 FORCED_REDRAW_STATE_WAITING_FOR_COMMIT, |
| 91 FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION, | 93 FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION, |
| 92 FORCED_REDRAW_STATE_WAITING_FOR_DRAW, | 94 FORCED_REDRAW_STATE_WAITING_FOR_DRAW, |
| 93 }; | 95 }; |
| 94 static const char* ForcedRedrawOnTimeoutStateToString( | 96 static const char* ForcedRedrawOnTimeoutStateToString( |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 149 |
| 148 // Indicates that the system has entered and left a BeginImplFrame callback. | 150 // Indicates that the system has entered and left a BeginImplFrame callback. |
| 149 // The scheduler will not draw more than once in a given BeginImplFrame | 151 // The scheduler will not draw more than once in a given BeginImplFrame |
| 150 // callback nor send more than one BeginMainFrame message. | 152 // callback nor send more than one BeginMainFrame message. |
| 151 void OnBeginImplFrame(); | 153 void OnBeginImplFrame(); |
| 152 // Indicates that the scheduler has entered the draw phase. The scheduler | 154 // Indicates that the scheduler has entered the draw phase. The scheduler |
| 153 // will not draw more than once in a single draw phase. | 155 // will not draw more than once in a single draw phase. |
| 154 // TODO(sunnyps): Rename OnBeginImplFrameDeadline to OnDraw or similar. | 156 // TODO(sunnyps): Rename OnBeginImplFrameDeadline to OnDraw or similar. |
| 155 void OnBeginImplFrameDeadline(); | 157 void OnBeginImplFrameDeadline(); |
| 156 void OnBeginImplFrameIdle(); | 158 void OnBeginImplFrameIdle(); |
| 157 | |
| 158 int current_frame_number() const { return current_frame_number_; } | |
| 159 | |
| 160 BeginImplFrameState begin_impl_frame_state() const { | 159 BeginImplFrameState begin_impl_frame_state() const { |
| 161 return begin_impl_frame_state_; | 160 return begin_impl_frame_state_; |
| 162 } | 161 } |
| 163 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; | 162 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; |
| 164 | 163 |
| 165 // If the main thread didn't manage to produce a new frame in time for the | 164 // If the main thread didn't manage to produce a new frame in time for the |
| 166 // impl thread to draw, it is in a high latency mode. | 165 // impl thread to draw, it is in a high latency mode. |
| 167 bool main_thread_missed_last_deadline() const { | 166 bool main_thread_missed_last_deadline() const { |
| 168 return main_thread_missed_last_deadline_; | 167 return main_thread_missed_last_deadline_; |
| 169 } | 168 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 bool did_draw_in_last_frame_; | 348 bool did_draw_in_last_frame_; |
| 350 bool did_swap_in_last_frame_; | 349 bool did_swap_in_last_frame_; |
| 351 | 350 |
| 352 private: | 351 private: |
| 353 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 352 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 354 }; | 353 }; |
| 355 | 354 |
| 356 } // namespace cc | 355 } // namespace cc |
| 357 | 356 |
| 358 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 357 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |