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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
14 #include "cc/output/begin_frame_args.h" | 14 #include "cc/output/begin_frame_args.h" |
15 #include "cc/scheduler/draw_swap_readback_result.h" | 15 #include "cc/scheduler/draw_result.h" |
16 #include "cc/scheduler/scheduler_settings.h" | 16 #include "cc/scheduler/scheduler_settings.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class Value; | 19 class Value; |
20 } | 20 } |
21 | 21 |
22 namespace cc { | 22 namespace cc { |
23 | 23 |
24 // The SchedulerStateMachine decides how to coordinate main thread activites | 24 // The SchedulerStateMachine decides how to coordinate main thread activites |
25 // like painting/running javascript with rendering and input activities on the | 25 // like painting/running javascript with rendering and input activities on the |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 // Notification from the OutputSurface that a swap has been consumed. | 187 // Notification from the OutputSurface that a swap has been consumed. |
188 void DidSwapBuffersComplete(); | 188 void DidSwapBuffersComplete(); |
189 | 189 |
190 // Indicates whether to prioritize animation smoothness over new content | 190 // Indicates whether to prioritize animation smoothness over new content |
191 // activation. | 191 // activation. |
192 void SetSmoothnessTakesPriority(bool smoothness_takes_priority); | 192 void SetSmoothnessTakesPriority(bool smoothness_takes_priority); |
193 bool smoothness_takes_priority() const { return smoothness_takes_priority_; } | 193 bool smoothness_takes_priority() const { return smoothness_takes_priority_; } |
194 | 194 |
195 // 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. |
196 void DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DrawResult result); | 196 void DidDrawIfPossibleCompleted(DrawResult result); |
197 | 197 |
198 // 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 |
199 // 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 |
200 // thread to main. | 200 // thread to main. |
201 void SetNeedsCommit(); | 201 void SetNeedsCommit(); |
202 | 202 |
203 // As SetNeedsCommit(), but ensures the BeginMainFrame will be sent even | 203 // As SetNeedsCommit(), but ensures the BeginMainFrame will be sent even |
204 // if we are not visible. After this call we expect to go through | 204 // if we are not visible. After this call we expect to go through |
205 // the forced commit flow and then return to waiting for a non-forced | 205 // the forced commit flow and then return to waiting for a non-forced |
206 // BeginMainFrame to finish. | 206 // BeginMainFrame to finish. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 bool ShouldDraw() const; | 264 bool ShouldDraw() const; |
265 bool ShouldActivatePendingTree() const; | 265 bool ShouldActivatePendingTree() const; |
266 bool ShouldUpdateVisibleTiles() const; | 266 bool ShouldUpdateVisibleTiles() const; |
267 bool ShouldSendBeginMainFrame() const; | 267 bool ShouldSendBeginMainFrame() const; |
268 bool ShouldCommit() const; | 268 bool ShouldCommit() const; |
269 bool ShouldManageTiles() const; | 269 bool ShouldManageTiles() const; |
270 | 270 |
271 void AdvanceCurrentFrameNumber(); | 271 void AdvanceCurrentFrameNumber(); |
272 bool HasSentBeginMainFrameThisFrame() const; | 272 bool HasSentBeginMainFrameThisFrame() const; |
273 bool HasUpdatedVisibleTilesThisFrame() const; | 273 bool HasUpdatedVisibleTilesThisFrame() const; |
| 274 bool HasRequestedSwapThisFrame() const; |
274 bool HasSwappedThisFrame() const; | 275 bool HasSwappedThisFrame() const; |
275 | 276 |
276 void UpdateStateOnCommit(bool commit_was_aborted); | 277 void UpdateStateOnCommit(bool commit_was_aborted); |
277 void UpdateStateOnActivation(); | 278 void UpdateStateOnActivation(); |
278 void UpdateStateOnDraw(bool did_request_swap); | 279 void UpdateStateOnDraw(bool did_request_swap); |
279 void UpdateStateOnManageTiles(); | 280 void UpdateStateOnManageTiles(); |
280 | 281 |
281 const SchedulerSettings settings_; | 282 const SchedulerSettings settings_; |
282 | 283 |
283 OutputSurfaceState output_surface_state_; | 284 OutputSurfaceState output_surface_state_; |
284 BeginImplFrameState begin_impl_frame_state_; | 285 BeginImplFrameState begin_impl_frame_state_; |
285 CommitState commit_state_; | 286 CommitState commit_state_; |
286 ForcedRedrawOnTimeoutState forced_redraw_state_; | 287 ForcedRedrawOnTimeoutState forced_redraw_state_; |
287 SynchronousReadbackState readback_state_; | 288 SynchronousReadbackState readback_state_; |
288 | 289 |
289 BeginFrameArgs begin_impl_frame_args_; | 290 BeginFrameArgs begin_impl_frame_args_; |
290 | 291 |
291 int commit_count_; | 292 int commit_count_; |
292 int current_frame_number_; | 293 int current_frame_number_; |
293 int last_frame_number_animate_performed_; | 294 int last_frame_number_animate_performed_; |
294 int last_frame_number_swap_performed_; | 295 int last_frame_number_swap_performed_; |
| 296 int last_frame_number_swap_requested_; |
295 int last_frame_number_begin_main_frame_sent_; | 297 int last_frame_number_begin_main_frame_sent_; |
296 int last_frame_number_update_visible_tiles_was_called_; | 298 int last_frame_number_update_visible_tiles_was_called_; |
297 | 299 |
298 // manage_tiles_funnel_ is "filled" each time ManageTiles is called | 300 // manage_tiles_funnel_ is "filled" each time ManageTiles is called |
299 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 301 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
300 // we start throttling ACTION_MANAGE_TILES such that we average one | 302 // we start throttling ACTION_MANAGE_TILES such that we average one |
301 // ManageTile per BeginImplFrame. | 303 // ManageTile per BeginImplFrame. |
302 int manage_tiles_funnel_; | 304 int manage_tiles_funnel_; |
303 int consecutive_checkerboard_animations_; | 305 int consecutive_checkerboard_animations_; |
304 int max_pending_swaps_; | 306 int max_pending_swaps_; |
(...skipping 17 matching lines...) Expand all Loading... |
322 bool continuous_painting_; | 324 bool continuous_painting_; |
323 bool needs_back_to_back_readback_; | 325 bool needs_back_to_back_readback_; |
324 | 326 |
325 private: | 327 private: |
326 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 328 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
327 }; | 329 }; |
328 | 330 |
329 } // namespace cc | 331 } // namespace cc |
330 | 332 |
331 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 333 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |