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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 void OnBeginImplFrameIdle(); | 138 void OnBeginImplFrameIdle(); |
139 BeginImplFrameState begin_impl_frame_state() const { | 139 BeginImplFrameState begin_impl_frame_state() const { |
140 return begin_impl_frame_state_; | 140 return begin_impl_frame_state_; |
141 } | 141 } |
142 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; | 142 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; |
143 | 143 |
144 // If the main thread didn't manage to produce a new frame in time for the | 144 // If the main thread didn't manage to produce a new frame in time for the |
145 // impl thread to draw, it is in a high latency mode. | 145 // impl thread to draw, it is in a high latency mode. |
146 bool MainThreadIsInHighLatencyMode() const; | 146 bool MainThreadIsInHighLatencyMode() const; |
147 | 147 |
| 148 bool SwapThrottled() const; |
| 149 |
148 // Indicates whether the LayerTreeHostImpl is visible. | 150 // Indicates whether the LayerTreeHostImpl is visible. |
149 void SetVisible(bool visible); | 151 void SetVisible(bool visible); |
150 bool visible() const { return visible_; } | 152 bool visible() const { return visible_; } |
151 | 153 |
152 // Indicates that a redraw is required, either due to the impl tree changing | 154 // Indicates that a redraw is required, either due to the impl tree changing |
153 // or the screen being damaged and simply needing redisplay. | 155 // or the screen being damaged and simply needing redisplay. |
154 void SetNeedsRedraw(); | 156 void SetNeedsRedraw(); |
155 bool needs_redraw() const { return needs_redraw_; } | 157 bool needs_redraw() const { return needs_redraw_; } |
156 | 158 |
157 void SetNeedsAnimate(); | 159 void SetNeedsAnimate(); |
158 bool needs_animate() const { return needs_animate_; } | 160 bool needs_animate() const { return needs_animate_; } |
159 | 161 |
| 162 bool OnlyImplSideUpdatesExpected() const; |
| 163 |
160 // Indicates that prepare-tiles is required. This guarantees another | 164 // Indicates that prepare-tiles is required. This guarantees another |
161 // PrepareTiles will occur shortly (even if no redraw is required). | 165 // PrepareTiles will occur shortly (even if no redraw is required). |
162 void SetNeedsPrepareTiles(); | 166 void SetNeedsPrepareTiles(); |
163 | 167 |
164 // Make deadline wait for ReadyToDraw signal. | 168 // Make deadline wait for ReadyToDraw signal. |
165 void SetWaitForReadyToDraw(); | 169 void SetWaitForReadyToDraw(); |
166 | 170 |
167 // Sets how many swaps can be pending to the OutputSurface. | 171 // Sets how many swaps can be pending to the OutputSurface. |
168 void SetMaxSwapsPending(int max); | 172 void SetMaxSwapsPending(int max); |
169 | 173 |
(...skipping 18 matching lines...) Expand all Loading... |
188 return impl_latency_takes_priority_; | 192 return impl_latency_takes_priority_; |
189 } | 193 } |
190 | 194 |
191 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. | 195 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. |
192 void DidDrawIfPossibleCompleted(DrawResult result); | 196 void DidDrawIfPossibleCompleted(DrawResult result); |
193 | 197 |
194 // Indicates that a new commit flow needs to be performed, either to pull | 198 // Indicates that a new commit flow needs to be performed, either to pull |
195 // updates from the main thread to the impl, or to push deltas from the impl | 199 // updates from the main thread to the impl, or to push deltas from the impl |
196 // thread to main. | 200 // thread to main. |
197 void SetNeedsCommit(); | 201 void SetNeedsCommit(); |
| 202 bool needs_commit() const { return needs_commit_; } |
198 | 203 |
199 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME | 204 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME |
200 // from NextAction. | 205 // from NextAction. |
201 // Indicates that all painting is complete. | 206 // Indicates that all painting is complete. |
202 void NotifyReadyToCommit(); | 207 void NotifyReadyToCommit(); |
203 | 208 |
204 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME | 209 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME |
205 // from NextAction if the client rejects the BeginMainFrame message. | 210 // from NextAction if the client rejects the BeginMainFrame message. |
206 void BeginMainFrameAborted(CommitEarlyOutReason reason); | 211 void BeginMainFrameAborted(CommitEarlyOutReason reason); |
207 | 212 |
208 // Set that we can create the first OutputSurface and start the scheduler. | 213 // Set that we can create the first OutputSurface and start the scheduler. |
209 void SetCanStart() { can_start_ = true; } | 214 void SetCanStart() { can_start_ = true; } |
210 // Allow access of the can_start_ state in tests. | 215 // Allow access of the can_start_ state in tests. |
211 bool CanStartForTesting() const { return can_start_; } | 216 bool CanStartForTesting() const { return can_start_; } |
212 | 217 |
| 218 // Indicates production should be skipped to recover latency. |
213 void SetSkipNextBeginMainFrameToReduceLatency(); | 219 void SetSkipNextBeginMainFrameToReduceLatency(); |
214 | 220 |
215 // Indicates whether drawing would, at this time, make sense. | 221 // Indicates whether drawing would, at this time, make sense. |
216 // CanDraw can be used to suppress flashes or checkerboarding | 222 // CanDraw can be used to suppress flashes or checkerboarding |
217 // when such behavior would be undesirable. | 223 // when such behavior would be undesirable. |
218 void SetCanDraw(bool can); | 224 void SetCanDraw(bool can); |
219 | 225 |
220 // Indicates that scheduled BeginMainFrame is started. | 226 // Indicates that scheduled BeginMainFrame is started. |
221 void NotifyBeginMainFrameStarted(); | 227 void NotifyBeginMainFrameStarted(); |
222 | 228 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 bool needs_commit_; | 331 bool needs_commit_; |
326 bool visible_; | 332 bool visible_; |
327 bool can_start_; | 333 bool can_start_; |
328 bool can_draw_; | 334 bool can_draw_; |
329 bool has_pending_tree_; | 335 bool has_pending_tree_; |
330 bool pending_tree_is_ready_for_activation_; | 336 bool pending_tree_is_ready_for_activation_; |
331 bool active_tree_needs_first_draw_; | 337 bool active_tree_needs_first_draw_; |
332 bool did_create_and_initialize_first_output_surface_; | 338 bool did_create_and_initialize_first_output_surface_; |
333 bool impl_latency_takes_priority_; | 339 bool impl_latency_takes_priority_; |
334 bool skip_next_begin_main_frame_to_reduce_latency_; | 340 bool skip_next_begin_main_frame_to_reduce_latency_; |
335 bool skip_begin_main_frame_to_reduce_latency_; | |
336 bool continuous_painting_; | 341 bool continuous_painting_; |
337 bool children_need_begin_frames_; | 342 bool children_need_begin_frames_; |
338 bool defer_commits_; | 343 bool defer_commits_; |
339 bool video_needs_begin_frames_; | 344 bool video_needs_begin_frames_; |
340 bool last_commit_had_no_updates_; | 345 bool last_commit_had_no_updates_; |
341 bool wait_for_active_tree_ready_to_draw_; | 346 bool wait_for_active_tree_ready_to_draw_; |
342 bool did_request_swap_in_last_frame_; | 347 bool did_request_swap_in_last_frame_; |
343 bool did_perform_swap_in_last_draw_; | 348 bool did_perform_swap_in_last_draw_; |
344 | 349 |
345 private: | 350 private: |
346 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 351 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
347 }; | 352 }; |
348 | 353 |
349 } // namespace cc | 354 } // namespace cc |
350 | 355 |
351 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 356 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |