Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: cc/scheduler/scheduler_state_machine.h

Issue 23495022: CC: Add a scheduled action for ManageTiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 }; 80 };
81 static const char* ForcedRedrawOnTimeoutStateToString( 81 static const char* ForcedRedrawOnTimeoutStateToString(
82 ForcedRedrawOnTimeoutState state); 82 ForcedRedrawOnTimeoutState state);
83 83
84 bool CommitPending() const { 84 bool CommitPending() const {
85 return commit_state_ == COMMIT_STATE_FRAME_IN_PROGRESS || 85 return commit_state_ == COMMIT_STATE_FRAME_IN_PROGRESS ||
86 commit_state_ == COMMIT_STATE_READY_TO_COMMIT; 86 commit_state_ == COMMIT_STATE_READY_TO_COMMIT;
87 } 87 }
88 88
89 bool RedrawPending() const { return needs_redraw_; } 89 bool RedrawPending() const { return needs_redraw_; }
90 bool ManageTilesPending() const { return needs_manage_tiles_; }
90 91
91 enum Action { 92 enum Action {
92 ACTION_NONE, 93 ACTION_NONE,
93 ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD, 94 ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD,
94 ACTION_COMMIT, 95 ACTION_COMMIT,
95 ACTION_UPDATE_VISIBLE_TILES, 96 ACTION_UPDATE_VISIBLE_TILES,
96 ACTION_ACTIVATE_PENDING_TREE, 97 ACTION_ACTIVATE_PENDING_TREE,
97 ACTION_DRAW_AND_SWAP_IF_POSSIBLE, 98 ACTION_DRAW_AND_SWAP_IF_POSSIBLE,
98 ACTION_DRAW_AND_SWAP_FORCED, 99 ACTION_DRAW_AND_SWAP_FORCED,
99 ACTION_DRAW_AND_SWAP_ABORT, 100 ACTION_DRAW_AND_SWAP_ABORT,
100 ACTION_DRAW_AND_READBACK, 101 ACTION_DRAW_AND_READBACK,
101 ACTION_BEGIN_OUTPUT_SURFACE_CREATION, 102 ACTION_BEGIN_OUTPUT_SURFACE_CREATION,
102 ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD, 103 ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD,
104 ACTION_MANAGE_TILES,
103 }; 105 };
104 static const char* ActionToString(Action action); 106 static const char* ActionToString(Action action);
105 107
106 scoped_ptr<base::Value> AsValue() const; 108 scoped_ptr<base::Value> AsValue() const;
107 109
108 Action NextAction() const; 110 Action NextAction() const;
109 void UpdateState(Action action); 111 void UpdateState(Action action);
110 void CheckInvariants(); 112 void CheckInvariants();
111 113
112 // Indicates whether the main thread needs a begin frame callback in order to 114 // Indicates whether the main thread needs a begin frame callback in order to
113 // make progress. 115 // make progress.
114 bool BeginFrameNeededToDrawByImplThread() const; 116 bool BeginFrameNeededToDrawByImplThread() const;
115 bool ProactiveBeginFrameWantedByImplThread() const; 117 bool ProactiveBeginFrameWantedByImplThread() const;
116 118
117 // Indicates that the system has entered and left a BeginFrame callback. 119 // Indicates that the system has entered and left a BeginFrame callback.
118 // The scheduler will not draw more than once in a given BeginFrame 120 // The scheduler will not draw more than once in a given BeginFrame
119 // callback nor send more than one BeginFrame message. 121 // callback nor send more than one BeginFrame message.
120 void DidEnterBeginFrame(const BeginFrameArgs& args); 122 void DidEnterBeginFrame(const BeginFrameArgs& args);
121 void DidLeaveBeginFrame(); 123 void DidLeaveBeginFrame();
122 bool inside_begin_frame() const { return inside_begin_frame_; } 124 bool inside_begin_frame() const { return inside_begin_frame_; }
123 125
124 // PollForAnticipatedDrawTriggers is used by the synchronous compositor to 126 // PollForAnticipatedDrawTriggers is used by the synchronous compositor to
125 // avoid requesting BeginImplFrames when we won't actually draw but still 127 // avoid requesting BeginImplFrames when we won't actually draw but still
126 // need to advance our state at vsync intervals. 128 // need to advance our state at vsync intervals.
127 void PollForAnticipatedDrawTriggers(); 129 void DidEnterPollForAnticipatedDrawTriggers();
130 void DidLeavePollForAnticipatedDrawTriggers();
131 bool inside_poll_for_anticipated_draw_triggers() const {
132 return inside_poll_for_anticipated_draw_triggers_;
133 }
128 134
129 // Indicates whether the LayerTreeHostImpl is visible. 135 // Indicates whether the LayerTreeHostImpl is visible.
130 void SetVisible(bool visible); 136 void SetVisible(bool visible);
131 137
132 // Indicates that a redraw is required, either due to the impl tree changing 138 // Indicates that a redraw is required, either due to the impl tree changing
133 // or the screen being damaged and simply needing redisplay. 139 // or the screen being damaged and simply needing redisplay.
134 void SetNeedsRedraw(); 140 void SetNeedsRedraw();
135 141
142 // Indicates that manage-tiles is required. This guarantees another
143 // ManageTiles will occur shortly (even if no redraw is required).
144 void SetNeedsManageTiles();
145
136 // Indicates whether a redraw is required because we are currently rendering 146 // Indicates whether a redraw is required because we are currently rendering
137 // with a low resolution or checkerboarded tile. 147 // with a low resolution or checkerboarded tile.
138 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); 148 void SetSwapUsedIncompleteTile(bool used_incomplete_tile);
139 149
140 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen or 150 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen or
141 // not. 151 // not.
142 void DidDrawIfPossibleCompleted(bool success); 152 void DidDrawIfPossibleCompleted(bool success);
143 153
144 // Indicates that a new commit flow needs to be performed, either to pull 154 // Indicates that a new commit flow needs to be performed, either to pull
145 // updates from the main thread to the impl, or to push deltas from the impl 155 // updates from the main thread to the impl, or to push deltas from the impl
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 bool PendingActivationsShouldBeForced() const; 205 bool PendingActivationsShouldBeForced() const;
196 206
197 bool ShouldBeginOutputSurfaceCreation() const; 207 bool ShouldBeginOutputSurfaceCreation() const;
198 bool ShouldDrawForced() const; 208 bool ShouldDrawForced() const;
199 bool ShouldDraw() const; 209 bool ShouldDraw() const;
200 bool ShouldActivatePendingTree() const; 210 bool ShouldActivatePendingTree() const;
201 bool ShouldAcquireLayerTexturesForMainThread() const; 211 bool ShouldAcquireLayerTexturesForMainThread() const;
202 bool ShouldUpdateVisibleTiles() const; 212 bool ShouldUpdateVisibleTiles() const;
203 bool ShouldSendBeginFrameToMainThread() const; 213 bool ShouldSendBeginFrameToMainThread() const;
204 bool ShouldCommit() const; 214 bool ShouldCommit() const;
215 bool ShouldManageTiles() const;
205 216
206 bool HasDrawnAndSwappedThisFrame() const; 217 bool HasDrawnAndSwappedThisFrame() const;
207 bool HasActivatedPendingTreeThisFrame() const; 218 bool HasActivatedPendingTreeThisFrame() const;
208 bool HasUpdatedVisibleTilesThisFrame() const; 219 bool HasUpdatedVisibleTilesThisFrame() const;
209 bool HasSentBeginFrameToMainThreadThisFrame() const; 220 bool HasSentBeginFrameToMainThreadThisFrame() const;
221 bool HasScheduledManageTilesThisFrame() const;
210 222
211 void UpdateStateOnCommit(bool commit_was_aborted); 223 void UpdateStateOnCommit(bool commit_was_aborted);
212 void UpdateStateOnActivation(); 224 void UpdateStateOnActivation();
213 void UpdateStateOnDraw(bool did_swap); 225 void UpdateStateOnDraw(bool did_swap);
226 void UpdateStateOnManageTiles();
214 227
215 const SchedulerSettings settings_; 228 const SchedulerSettings settings_;
216 229
217 OutputSurfaceState output_surface_state_; 230 OutputSurfaceState output_surface_state_;
218 CommitState commit_state_; 231 CommitState commit_state_;
219 TextureState texture_state_; 232 TextureState texture_state_;
220 ForcedRedrawOnTimeoutState forced_redraw_state_; 233 ForcedRedrawOnTimeoutState forced_redraw_state_;
221 SynchronousReadbackState readback_state_; 234 SynchronousReadbackState readback_state_;
222 235
223 int commit_count_; 236 int commit_count_;
224 int current_frame_number_; 237 int current_frame_number_;
225 int last_frame_number_where_begin_frame_sent_to_main_thread_; 238 int last_frame_number_where_begin_frame_sent_to_main_thread_;
226 int last_frame_number_swap_performed_; 239 int last_frame_number_swap_performed_;
227 int last_frame_number_where_update_visible_tiles_was_called_; 240 int last_frame_number_where_update_visible_tiles_was_called_;
228 int consecutive_failed_draws_; 241 int consecutive_failed_draws_;
229 bool needs_redraw_; 242 bool needs_redraw_;
243 bool needs_manage_tiles_;
230 bool swap_used_incomplete_tile_; 244 bool swap_used_incomplete_tile_;
231 bool needs_commit_; 245 bool needs_commit_;
232 bool main_thread_needs_layer_textures_; 246 bool main_thread_needs_layer_textures_;
233 bool inside_begin_frame_; 247 bool inside_begin_frame_;
248 bool inside_poll_for_anticipated_draw_triggers_;
249
234 BeginFrameArgs last_begin_frame_args_; 250 BeginFrameArgs last_begin_frame_args_;
235 bool visible_; 251 bool visible_;
236 bool can_start_; 252 bool can_start_;
237 bool can_draw_; 253 bool can_draw_;
238 bool has_pending_tree_; 254 bool has_pending_tree_;
239 bool pending_tree_is_ready_for_activation_; 255 bool pending_tree_is_ready_for_activation_;
240 bool active_tree_needs_first_draw_; 256 bool active_tree_needs_first_draw_;
241 bool draw_if_possible_failed_; 257 bool draw_if_possible_failed_;
242 bool did_create_and_initialize_first_output_surface_; 258 bool did_create_and_initialize_first_output_surface_;
243 259
244 private: 260 private:
245 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); 261 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
246 }; 262 };
247 263
248 } // namespace cc 264 } // namespace cc
249 265
250 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 266 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698