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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 Action NextAction() const; | 72 Action NextAction() const; |
73 void UpdateState(Action action); | 73 void UpdateState(Action action); |
74 | 74 |
75 // Indicates whether the main thread needs a begin frame callback in order to | 75 // Indicates whether the main thread needs a begin frame callback in order to |
76 // make progress. | 76 // make progress. |
77 bool BeginFrameNeededToDrawByImplThread() const; | 77 bool BeginFrameNeededToDrawByImplThread() const; |
78 bool ProactiveBeginFrameWantedByImplThread() const; | 78 bool ProactiveBeginFrameWantedByImplThread() const; |
79 | 79 |
80 // Indicates that the system has entered and left a BeginFrame callback. | 80 // Indicates that the system has entered and left a BeginFrame callback. |
81 // The scheduler will not draw more than once in a given BeginFrame | 81 // The scheduler will not draw more than once in a given BeginFrame |
82 // callback. | 82 // callback nor send more than one BeginFrame message. |
83 void DidEnterBeginFrame(const BeginFrameArgs& args); | 83 void DidEnterBeginFrame(const BeginFrameArgs& args); |
84 void DidLeaveBeginFrame(); | 84 void DidLeaveBeginFrame(); |
85 bool inside_begin_frame() const { return inside_begin_frame_; } | 85 bool inside_begin_frame() const { return inside_begin_frame_; } |
86 | 86 |
87 // Indicates whether the LayerTreeHostImpl is visible. | 87 // Indicates whether the LayerTreeHostImpl is visible. |
88 void SetVisible(bool visible); | 88 void SetVisible(bool visible); |
89 | 89 |
90 // Indicates that a redraw is required, either due to the impl tree changing | 90 // Indicates that a redraw is required, either due to the impl tree changing |
91 // or the screen being damaged and simply needing redisplay. | 91 // or the screen being damaged and simply needing redisplay. |
92 void SetNeedsRedraw(); | 92 void SetNeedsRedraw(); |
(...skipping 20 matching lines...) Expand all Loading... |
113 // begin frame to finish. | 113 // begin frame to finish. |
114 void SetNeedsForcedCommit(); | 114 void SetNeedsForcedCommit(); |
115 | 115 |
116 // Call this only in response to receiving an | 116 // Call this only in response to receiving an |
117 // ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD from NextAction. | 117 // ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD from NextAction. |
118 // Indicates that all painting is complete. | 118 // Indicates that all painting is complete. |
119 void FinishCommit(); | 119 void FinishCommit(); |
120 | 120 |
121 // Call this only in response to receiving an | 121 // Call this only in response to receiving an |
122 // ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD from NextAction if the client | 122 // ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD from NextAction if the client |
123 // rejects the begin frame message. | 123 // rejects the begin frame message. If did_handle is false, then |
124 void BeginFrameAbortedByMainThread(); | 124 // another commit will be retried soon. |
| 125 void BeginFrameAbortedByMainThread(bool did_handle); |
125 | 126 |
126 // Request exclusive access to the textures that back single buffered | 127 // Request exclusive access to the textures that back single buffered |
127 // layers on behalf of the main thread. Upon acquisition, | 128 // layers on behalf of the main thread. Upon acquisition, |
128 // ACTION_DRAW_IF_POSSIBLE will not draw until the main thread releases the | 129 // ACTION_DRAW_IF_POSSIBLE will not draw until the main thread releases the |
129 // textures to the impl thread by committing the layers. | 130 // textures to the impl thread by committing the layers. |
130 void SetMainThreadNeedsLayerTextures(); | 131 void SetMainThreadNeedsLayerTextures(); |
131 | 132 |
132 // Set that we can create the first OutputSurface and start the scheduler. | 133 // Set that we can create the first OutputSurface and start the scheduler. |
133 void SetCanStart() { can_start_ = true; } | 134 void SetCanStart() { can_start_ = true; } |
134 | 135 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 bool HasDrawnThisFrame() const; | 169 bool HasDrawnThisFrame() const; |
169 bool HasAttemptedTreeActivationThisFrame() const; | 170 bool HasAttemptedTreeActivationThisFrame() const; |
170 bool HasCheckedForCompletedTileUploadsThisFrame() const; | 171 bool HasCheckedForCompletedTileUploadsThisFrame() const; |
171 | 172 |
172 const SchedulerSettings settings_; | 173 const SchedulerSettings settings_; |
173 | 174 |
174 CommitState commit_state_; | 175 CommitState commit_state_; |
175 int commit_count_; | 176 int commit_count_; |
176 | 177 |
177 int current_frame_number_; | 178 int current_frame_number_; |
| 179 int last_frame_number_where_begin_frame_sent_to_main_thread_; |
178 int last_frame_number_where_draw_was_called_; | 180 int last_frame_number_where_draw_was_called_; |
179 int last_frame_number_where_tree_activation_attempted_; | 181 int last_frame_number_where_tree_activation_attempted_; |
180 int last_frame_number_where_check_for_completed_tile_uploads_called_; | 182 int last_frame_number_where_check_for_completed_tile_uploads_called_; |
181 int consecutive_failed_draws_; | 183 int consecutive_failed_draws_; |
182 int maximum_number_of_failed_draws_before_draw_is_forced_; | 184 int maximum_number_of_failed_draws_before_draw_is_forced_; |
183 bool needs_redraw_; | 185 bool needs_redraw_; |
184 bool swap_used_incomplete_tile_; | 186 bool swap_used_incomplete_tile_; |
185 bool needs_forced_redraw_; | 187 bool needs_forced_redraw_; |
186 bool needs_forced_redraw_after_next_commit_; | 188 bool needs_forced_redraw_after_next_commit_; |
187 bool needs_commit_; | 189 bool needs_commit_; |
(...skipping 11 matching lines...) Expand all Loading... |
199 OutputSurfaceState output_surface_state_; | 201 OutputSurfaceState output_surface_state_; |
200 bool did_create_and_initialize_first_output_surface_; | 202 bool did_create_and_initialize_first_output_surface_; |
201 | 203 |
202 private: | 204 private: |
203 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 205 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
204 }; | 206 }; |
205 | 207 |
206 } // namespace cc | 208 } // namespace cc |
207 | 209 |
208 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 210 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |