Index: cc/scheduler/scheduler_state_machine.h |
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h |
index aaefa37bc67bad6c2634d8b62a3c44bd59a64c57..35889d11758b2ade46bbf7b94518503cd72e4b47 100644 |
--- a/cc/scheduler/scheduler_state_machine.h |
+++ b/cc/scheduler/scheduler_state_machine.h |
@@ -45,6 +45,18 @@ class CC_EXPORT SchedulerStateMachine { |
}; |
static const char* OutputSurfaceStateToString(OutputSurfaceState state); |
+ // Note: BeginFrameState will always cycle through all the states in order. |
+ // Whether or not it actually waits or draws, it will at least try to wait in |
+ // BEGIN_FRAME_STATE_DEADLINE_PENDING and try to draw in |
+ // BEGIN_FRAME_STATE_INSIDE_DEADLINE |
+ enum BeginFrameState { |
+ BEGIN_FRAME_STATE_IDLE, |
+ BEGIN_FRAME_STATE_INSIDE_BEGIN_FRAME, |
+ BEGIN_FRAME_STATE_DEADLINE_PENDING, |
+ BEGIN_FRAME_STATE_INSIDE_DEADLINE, |
+ }; |
+ static const char* BeginFrameStateToString(BeginFrameState state); |
+ |
enum CommitState { |
COMMIT_STATE_IDLE, |
COMMIT_STATE_FRAME_IN_PROGRESS, |
@@ -82,8 +94,7 @@ class CC_EXPORT SchedulerStateMachine { |
ForcedRedrawOnTimeoutState state); |
bool CommitPending() const { |
- return commit_state_ == COMMIT_STATE_FRAME_IN_PROGRESS || |
- commit_state_ == COMMIT_STATE_READY_TO_COMMIT; |
+ return commit_state_ == COMMIT_STATE_FRAME_IN_PROGRESS; |
} |
bool RedrawPending() const { return needs_redraw_; } |
@@ -107,19 +118,24 @@ class CC_EXPORT SchedulerStateMachine { |
Action NextAction() const; |
void UpdateState(Action action); |
+ |
void CheckInvariants(); |
// Indicates whether the main thread needs a begin frame callback in order to |
// make progress. |
+ bool BeginFrameNeededByImplThread() const; |
bool BeginFrameNeededToDrawByImplThread() const; |
bool ProactiveBeginFrameWantedByImplThread() const; |
// Indicates that the system has entered and left a BeginFrame callback. |
// The scheduler will not draw more than once in a given BeginFrame |
// callback nor send more than one BeginFrame message. |
- void DidEnterBeginFrame(const BeginFrameArgs& args); |
- void DidLeaveBeginFrame(); |
- bool inside_begin_frame() const { return inside_begin_frame_; } |
+ void OnBeginFrame(const BeginFrameArgs& args); |
+ void OnBeginFrameDeadlinePending(); |
+ void OnBeginFrameDeadline(); |
+ void OnBeginFrameIdle(); |
+ bool ShouldTriggerBeginFrameDeadlineEarly() const; |
+ bool InsideBeginFrame() const; |
// Indicates whether the LayerTreeHostImpl is visible. |
void SetVisible(bool visible); |
@@ -127,13 +143,13 @@ class CC_EXPORT SchedulerStateMachine { |
// Indicates that a redraw is required, either due to the impl tree changing |
// or the screen being damaged and simply needing redisplay. |
void SetNeedsRedraw(); |
+ bool needs_redraw() const { return needs_redraw_; } |
// Indicates whether a redraw is required because we are currently rendering |
// with a low resolution or checkerboarded tile. |
void SetSwapUsedIncompleteTile(bool used_incomplete_tile); |
- // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen or |
- // not. |
+ // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. |
void DidDrawIfPossibleCompleted(bool success); |
// Indicates that a new commit flow needs to be performed, either to pull |
@@ -198,10 +214,9 @@ class CC_EXPORT SchedulerStateMachine { |
bool ShouldSendBeginFrameToMainThread() const; |
bool ShouldCommit() const; |
- bool HasDrawnAndSwappedThisFrame() const; |
- bool HasActivatedPendingTreeThisFrame() const; |
- bool HasUpdatedVisibleTilesThisFrame() const; |
bool HasSentBeginFrameToMainThreadThisFrame() const; |
+ bool HasUpdatedVisibleTilesThisFrame() const; |
+ bool HasSwappedThisFrame() const; |
void UpdateStateOnCommit(bool commit_was_aborted); |
void UpdateStateOnActivation(); |
@@ -210,23 +225,25 @@ class CC_EXPORT SchedulerStateMachine { |
const SchedulerSettings settings_; |
OutputSurfaceState output_surface_state_; |
+ BeginFrameState begin_frame_state_; |
CommitState commit_state_; |
TextureState texture_state_; |
ForcedRedrawOnTimeoutState forced_redraw_state_; |
SynchronousReadbackState readback_state_; |
+ BeginFrameArgs last_begin_frame_args_; |
+ |
int commit_count_; |
- int current_frame_number_; |
- int last_frame_number_where_begin_frame_sent_to_main_thread_; |
- int last_frame_number_swap_performed_; |
- int last_frame_number_where_update_visible_tiles_was_called_; |
+ int begin_frame_count_; |
+ int last_begin_frame_count_swap_performed_; |
+ int last_begin_frame_count_begin_frame_sent_to_main_thread_; |
enne (OOO)
2013/09/11 22:30:47
I like this a million times better than draw attem
brianderson
2013/09/12 00:12:34
I'll change it back to current_frame_number now th
|
+ int last_begin_frame_count_update_visible_tiles_was_called_; |
+ |
int consecutive_failed_draws_; |
bool needs_redraw_; |
bool swap_used_incomplete_tile_; |
bool needs_commit_; |
bool main_thread_needs_layer_textures_; |
- bool inside_begin_frame_; |
- BeginFrameArgs last_begin_frame_args_; |
bool visible_; |
bool can_start_; |
bool can_draw_; |