| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // wait in BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME and try to draw in | 55 // wait in BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME and try to draw in |
| 56 // BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE | 56 // BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE |
| 57 enum BeginImplFrameState { | 57 enum BeginImplFrameState { |
| 58 BEGIN_IMPL_FRAME_STATE_IDLE, | 58 BEGIN_IMPL_FRAME_STATE_IDLE, |
| 59 BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING, | 59 BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING, |
| 60 BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME, | 60 BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME, |
| 61 BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, | 61 BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, |
| 62 }; | 62 }; |
| 63 static const char* BeginImplFrameStateToString(BeginImplFrameState state); | 63 static const char* BeginImplFrameStateToString(BeginImplFrameState state); |
| 64 | 64 |
| 65 enum BeginImplFrameDeadlineMode { |
| 66 BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE, |
| 67 BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR, |
| 68 BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE, |
| 69 }; |
| 70 static const char* BeginImplFrameDeadlineModeToString( |
| 71 BeginImplFrameDeadlineMode mode); |
| 72 |
| 65 enum CommitState { | 73 enum CommitState { |
| 66 COMMIT_STATE_IDLE, | 74 COMMIT_STATE_IDLE, |
| 67 COMMIT_STATE_BEGIN_MAIN_FRAME_SENT, | 75 COMMIT_STATE_BEGIN_MAIN_FRAME_SENT, |
| 68 COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED, | 76 COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED, |
| 69 COMMIT_STATE_READY_TO_COMMIT, | 77 COMMIT_STATE_READY_TO_COMMIT, |
| 70 COMMIT_STATE_WAITING_FOR_ACTIVATION, | 78 COMMIT_STATE_WAITING_FOR_ACTIVATION, |
| 71 COMMIT_STATE_WAITING_FOR_DRAW, | 79 COMMIT_STATE_WAITING_FOR_DRAW, |
| 72 }; | 80 }; |
| 73 static const char* CommitStateToString(CommitState state); | 81 static const char* CommitStateToString(CommitState state); |
| 74 | 82 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // necessary actions on the floor. | 129 // necessary actions on the floor. |
| 122 bool ShouldPollForAnticipatedDrawTriggers() const; | 130 bool ShouldPollForAnticipatedDrawTriggers() const; |
| 123 | 131 |
| 124 // Indicates that the system has entered and left a BeginImplFrame callback. | 132 // Indicates that the system has entered and left a BeginImplFrame callback. |
| 125 // The scheduler will not draw more than once in a given BeginImplFrame | 133 // The scheduler will not draw more than once in a given BeginImplFrame |
| 126 // callback nor send more than one BeginMainFrame message. | 134 // callback nor send more than one BeginMainFrame message. |
| 127 void OnBeginImplFrame(const BeginFrameArgs& args); | 135 void OnBeginImplFrame(const BeginFrameArgs& args); |
| 128 void OnBeginImplFrameDeadlinePending(); | 136 void OnBeginImplFrameDeadlinePending(); |
| 129 void OnBeginImplFrameDeadline(); | 137 void OnBeginImplFrameDeadline(); |
| 130 void OnBeginImplFrameIdle(); | 138 void OnBeginImplFrameIdle(); |
| 131 bool ShouldTriggerBeginImplFrameDeadlineEarly() const; | |
| 132 BeginImplFrameState begin_impl_frame_state() const { | 139 BeginImplFrameState begin_impl_frame_state() const { |
| 133 return begin_impl_frame_state_; | 140 return begin_impl_frame_state_; |
| 134 } | 141 } |
| 142 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; |
| 135 | 143 |
| 136 // 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 |
| 137 // impl thread to draw, it is in a high latency mode. | 145 // impl thread to draw, it is in a high latency mode. |
| 138 bool MainThreadIsInHighLatencyMode() const; | 146 bool MainThreadIsInHighLatencyMode() const; |
| 139 | 147 |
| 140 // PollForAnticipatedDrawTriggers is used by the synchronous compositor to | 148 // PollForAnticipatedDrawTriggers is used by the synchronous compositor to |
| 141 // avoid requesting BeginImplFrames when we won't actually draw but still | 149 // avoid requesting BeginImplFrames when we won't actually draw but still |
| 142 // need to advance our state at vsync intervals. | 150 // need to advance our state at vsync intervals. |
| 143 void DidEnterPollForAnticipatedDrawTriggers(); | 151 void DidEnterPollForAnticipatedDrawTriggers(); |
| 144 void DidLeavePollForAnticipatedDrawTriggers(); | 152 void DidLeavePollForAnticipatedDrawTriggers(); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); | 259 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); |
| 252 bool children_need_begin_frames() const { | 260 bool children_need_begin_frames() const { |
| 253 return children_need_begin_frames_; | 261 return children_need_begin_frames_; |
| 254 } | 262 } |
| 255 | 263 |
| 256 protected: | 264 protected: |
| 257 bool BeginFrameNeededToAnimateOrDraw() const; | 265 bool BeginFrameNeededToAnimateOrDraw() const; |
| 258 bool BeginFrameNeededForChildren() const; | 266 bool BeginFrameNeededForChildren() const; |
| 259 bool ProactiveBeginFrameWanted() const; | 267 bool ProactiveBeginFrameWanted() const; |
| 260 | 268 |
| 269 bool ShouldTriggerBeginImplFrameDeadlineImmediately() const; |
| 270 |
| 261 // True if we need to force activations to make forward progress. | 271 // True if we need to force activations to make forward progress. |
| 262 bool PendingActivationsShouldBeForced() const; | 272 bool PendingActivationsShouldBeForced() const; |
| 263 | 273 |
| 264 bool ShouldAnimate() const; | 274 bool ShouldAnimate() const; |
| 265 bool ShouldBeginOutputSurfaceCreation() const; | 275 bool ShouldBeginOutputSurfaceCreation() const; |
| 266 bool ShouldDrawForced() const; | 276 bool ShouldDrawForced() const; |
| 267 bool ShouldDraw() const; | 277 bool ShouldDraw() const; |
| 268 bool ShouldActivatePendingTree() const; | 278 bool ShouldActivatePendingTree() const; |
| 269 bool ShouldSendBeginMainFrame() const; | 279 bool ShouldSendBeginMainFrame() const; |
| 270 bool ShouldCommit() const; | 280 bool ShouldCommit() const; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 bool impl_latency_takes_priority_on_battery_; | 335 bool impl_latency_takes_priority_on_battery_; |
| 326 bool children_need_begin_frames_; | 336 bool children_need_begin_frames_; |
| 327 | 337 |
| 328 private: | 338 private: |
| 329 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 339 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 330 }; | 340 }; |
| 331 | 341 |
| 332 } // namespace cc | 342 } // namespace cc |
| 333 | 343 |
| 334 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 344 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |