| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 OUTPUT_SURFACE_NONE, | 52 OUTPUT_SURFACE_NONE, |
| 53 OUTPUT_SURFACE_ACTIVE, | 53 OUTPUT_SURFACE_ACTIVE, |
| 54 OUTPUT_SURFACE_CREATING, | 54 OUTPUT_SURFACE_CREATING, |
| 55 OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT, | 55 OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT, |
| 56 OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION, | 56 OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION, |
| 57 }; | 57 }; |
| 58 static const char* OutputSurfaceStateToString(OutputSurfaceState state); | 58 static const char* OutputSurfaceStateToString(OutputSurfaceState state); |
| 59 | 59 |
| 60 // Note: BeginImplFrameState does not cycle through these states in a fixed | 60 // Note: BeginImplFrameState does not cycle through these states in a fixed |
| 61 // order on all platforms. It's up to the scheduler to set these correctly. | 61 // order on all platforms. It's up to the scheduler to set these correctly. |
| 62 // TODO(sunnyps): Rename the states to IDLE, ANIMATE, WAITING_FOR_DEADLINE and | |
| 63 // DRAW. | |
| 64 enum BeginImplFrameState { | 62 enum BeginImplFrameState { |
| 65 BEGIN_IMPL_FRAME_STATE_IDLE, | 63 BEGIN_IMPL_FRAME_STATE_IDLE, |
| 66 BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING, | |
| 67 BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME, | 64 BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME, |
| 68 BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, | 65 BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, |
| 69 }; | 66 }; |
| 70 static const char* BeginImplFrameStateToString(BeginImplFrameState state); | 67 static const char* BeginImplFrameStateToString(BeginImplFrameState state); |
| 71 | 68 |
| 72 enum BeginImplFrameDeadlineMode { | 69 enum BeginImplFrameDeadlineMode { |
| 73 BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE, | 70 BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE, |
| 74 BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE, | 71 BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE, |
| 75 BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR, | 72 BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR, |
| 76 BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE, | 73 BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 void AbortDrawAndSwap(); | 143 void AbortDrawAndSwap(); |
| 147 | 144 |
| 148 // Indicates whether the impl thread needs a BeginImplFrame callback in order | 145 // Indicates whether the impl thread needs a BeginImplFrame callback in order |
| 149 // to make progress. | 146 // to make progress. |
| 150 bool BeginFrameNeeded() const; | 147 bool BeginFrameNeeded() const; |
| 151 | 148 |
| 152 // Indicates that the system has entered and left a BeginImplFrame callback. | 149 // Indicates that the system has entered and left a BeginImplFrame callback. |
| 153 // The scheduler will not draw more than once in a given BeginImplFrame | 150 // The scheduler will not draw more than once in a given BeginImplFrame |
| 154 // callback nor send more than one BeginMainFrame message. | 151 // callback nor send more than one BeginMainFrame message. |
| 155 void OnBeginImplFrame(); | 152 void OnBeginImplFrame(); |
| 156 void OnBeginImplFrameDeadlinePending(); | |
| 157 // Indicates that the scheduler has entered the draw phase. The scheduler | 153 // Indicates that the scheduler has entered the draw phase. The scheduler |
| 158 // will not draw more than once in a single draw phase. | 154 // will not draw more than once in a single draw phase. |
| 159 // TODO(sunnyps): Rename OnBeginImplFrameDeadline to OnDraw or similar. | 155 // TODO(sunnyps): Rename OnBeginImplFrameDeadline to OnDraw or similar. |
| 160 void OnBeginImplFrameDeadline(); | 156 void OnBeginImplFrameDeadline(); |
| 161 void OnBeginImplFrameIdle(); | 157 void OnBeginImplFrameIdle(); |
| 162 BeginImplFrameState begin_impl_frame_state() const { | 158 BeginImplFrameState begin_impl_frame_state() const { |
| 163 return begin_impl_frame_state_; | 159 return begin_impl_frame_state_; |
| 164 } | 160 } |
| 165 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; | 161 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; |
| 166 | 162 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 bool did_draw_in_last_frame_; | 357 bool did_draw_in_last_frame_; |
| 362 bool did_swap_in_last_frame_; | 358 bool did_swap_in_last_frame_; |
| 363 | 359 |
| 364 private: | 360 private: |
| 365 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 361 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 366 }; | 362 }; |
| 367 | 363 |
| 368 } // namespace cc | 364 } // namespace cc |
| 369 | 365 |
| 370 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 366 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |