| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME, | 56 BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME, |
| 57 BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, | 57 BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, |
| 58 }; | 58 }; |
| 59 static const char* BeginImplFrameStateToString(BeginImplFrameState state); | 59 static const char* BeginImplFrameStateToString(BeginImplFrameState state); |
| 60 | 60 |
| 61 enum CommitState { | 61 enum CommitState { |
| 62 COMMIT_STATE_IDLE, | 62 COMMIT_STATE_IDLE, |
| 63 COMMIT_STATE_BEGIN_MAIN_FRAME_SENT, | 63 COMMIT_STATE_BEGIN_MAIN_FRAME_SENT, |
| 64 COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED, | 64 COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED, |
| 65 COMMIT_STATE_READY_TO_COMMIT, | 65 COMMIT_STATE_READY_TO_COMMIT, |
| 66 COMMIT_STATE_WAITING_FOR_ACTIVATION, |
| 66 COMMIT_STATE_WAITING_FOR_FIRST_DRAW, | 67 COMMIT_STATE_WAITING_FOR_FIRST_DRAW, |
| 67 }; | 68 }; |
| 68 static const char* CommitStateToString(CommitState state); | 69 static const char* CommitStateToString(CommitState state); |
| 69 | 70 |
| 70 enum TextureState { | 71 enum TextureState { |
| 71 LAYER_TEXTURE_STATE_UNLOCKED, | 72 LAYER_TEXTURE_STATE_UNLOCKED, |
| 72 LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD, | 73 LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD, |
| 73 LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD, | 74 LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD, |
| 74 }; | 75 }; |
| 75 static const char* TextureStateToString(TextureState state); | 76 static const char* TextureStateToString(TextureState state); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 93 FORCED_REDRAW_STATE_WAITING_FOR_DRAW, | 94 FORCED_REDRAW_STATE_WAITING_FOR_DRAW, |
| 94 }; | 95 }; |
| 95 static const char* ForcedRedrawOnTimeoutStateToString( | 96 static const char* ForcedRedrawOnTimeoutStateToString( |
| 96 ForcedRedrawOnTimeoutState state); | 97 ForcedRedrawOnTimeoutState state); |
| 97 | 98 |
| 98 bool CommitPending() const { | 99 bool CommitPending() const { |
| 99 return commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 100 return commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
| 100 commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED || | 101 commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED || |
| 101 commit_state_ == COMMIT_STATE_READY_TO_COMMIT; | 102 commit_state_ == COMMIT_STATE_READY_TO_COMMIT; |
| 102 } | 103 } |
| 104 CommitState commit_state() const { return commit_state_; } |
| 103 | 105 |
| 104 bool RedrawPending() const { return needs_redraw_; } | 106 bool RedrawPending() const { return needs_redraw_; } |
| 105 bool ManageTilesPending() const { return needs_manage_tiles_; } | 107 bool ManageTilesPending() const { return needs_manage_tiles_; } |
| 106 | 108 |
| 107 enum Action { | 109 enum Action { |
| 108 ACTION_NONE, | 110 ACTION_NONE, |
| 109 ACTION_SEND_BEGIN_MAIN_FRAME, | 111 ACTION_SEND_BEGIN_MAIN_FRAME, |
| 110 ACTION_COMMIT, | 112 ACTION_COMMIT, |
| 111 ACTION_UPDATE_VISIBLE_TILES, | 113 ACTION_UPDATE_VISIBLE_TILES, |
| 112 ACTION_ACTIVATE_PENDING_TREE, | 114 ACTION_ACTIVATE_PENDING_TREE, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // when such behavior would be undesirable. | 226 // when such behavior would be undesirable. |
| 225 void SetCanDraw(bool can); | 227 void SetCanDraw(bool can); |
| 226 | 228 |
| 227 // Indicates that scheduled BeginMainFrame is started. | 229 // Indicates that scheduled BeginMainFrame is started. |
| 228 void NotifyBeginMainFrameStarted(); | 230 void NotifyBeginMainFrameStarted(); |
| 229 | 231 |
| 230 // Indicates that the pending tree is ready for activation. | 232 // Indicates that the pending tree is ready for activation. |
| 231 void NotifyReadyToActivate(); | 233 void NotifyReadyToActivate(); |
| 232 | 234 |
| 233 bool has_pending_tree() const { return has_pending_tree_; } | 235 bool has_pending_tree() const { return has_pending_tree_; } |
| 236 bool active_tree_needs_first_draw() const { |
| 237 return active_tree_needs_first_draw_; |
| 238 } |
| 234 | 239 |
| 235 void DidManageTiles(); | 240 void DidManageTiles(); |
| 236 void DidLoseOutputSurface(); | 241 void DidLoseOutputSurface(); |
| 237 void DidCreateAndInitializeOutputSurface(); | 242 void DidCreateAndInitializeOutputSurface(); |
| 238 bool HasInitializedOutputSurface() const; | 243 bool HasInitializedOutputSurface() const; |
| 239 | 244 |
| 240 // True if we need to abort draws to make forward progress. | 245 // True if we need to abort draws to make forward progress. |
| 241 bool PendingDrawsShouldBeAborted() const; | 246 bool PendingDrawsShouldBeAborted() const; |
| 242 | 247 |
| 243 bool SupportsProactiveBeginImplFrame() const; | 248 bool SupportsProactiveBeginImplFrame() const; |
| 244 | 249 |
| 245 CommitState commit_state() const { return commit_state_; } | |
| 246 | |
| 247 protected: | 250 protected: |
| 248 bool BeginImplFrameNeededToDraw() const; | 251 bool BeginImplFrameNeededToDraw() const; |
| 249 bool ProactiveBeginImplFrameWanted() const; | 252 bool ProactiveBeginImplFrameWanted() const; |
| 250 | 253 |
| 251 // True if we need to force activations to make forward progress. | 254 // True if we need to force activations to make forward progress. |
| 252 bool PendingActivationsShouldBeForced() const; | 255 bool PendingActivationsShouldBeForced() const; |
| 253 | 256 |
| 254 bool ShouldBeginOutputSurfaceCreation() const; | 257 bool ShouldBeginOutputSurfaceCreation() const; |
| 255 bool ShouldDrawForced() const; | 258 bool ShouldDrawForced() const; |
| 256 bool ShouldDraw() const; | 259 bool ShouldDraw() const; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 bool skip_next_begin_main_frame_to_reduce_latency_; | 316 bool skip_next_begin_main_frame_to_reduce_latency_; |
| 314 bool skip_begin_main_frame_to_reduce_latency_; | 317 bool skip_begin_main_frame_to_reduce_latency_; |
| 315 | 318 |
| 316 private: | 319 private: |
| 317 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 320 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 318 }; | 321 }; |
| 319 | 322 |
| 320 } // namespace cc | 323 } // namespace cc |
| 321 | 324 |
| 322 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 325 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |