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