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

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

Issue 1265023005: cc: Add SchedulerStateMachine::DidDraw and use for forced draws (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WillDidAction0
Patch Set: Don't swap after aborted draw in tests. Add DCHECKs. Created 5 years 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
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 static const char* ActionToString(Action action); 126 static const char* ActionToString(Action action);
127 127
128 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 128 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
129 void AsValueInto(base::trace_event::TracedValue* dict) const; 129 void AsValueInto(base::trace_event::TracedValue* dict) const;
130 130
131 Action NextAction() const; 131 Action NextAction() const;
132 void WillAnimate(); 132 void WillAnimate();
133 void WillSendBeginMainFrame(); 133 void WillSendBeginMainFrame();
134 void WillCommit(bool commit_had_no_updates); 134 void WillCommit(bool commit_had_no_updates);
135 void WillActivate(); 135 void WillActivate();
136 void WillDraw(bool did_request_swap); 136 void WillDraw();
137 void WillBeginOutputSurfaceCreation(); 137 void WillBeginOutputSurfaceCreation();
138 void WillPrepareTiles(); 138 void WillPrepareTiles();
139 void WillInvalidateOutputSurface(); 139 void WillInvalidateOutputSurface();
140 140
141 void DidDraw(DrawResult draw_result);
142
143 void AbortDrawAndSwap();
144
141 // Indicates whether the impl thread needs a BeginImplFrame callback in order 145 // Indicates whether the impl thread needs a BeginImplFrame callback in order
142 // to make progress. 146 // to make progress.
143 bool BeginFrameNeeded() const; 147 bool BeginFrameNeeded() const;
144 148
145 // Indicates that the system has entered and left a BeginImplFrame callback. 149 // Indicates that the system has entered and left a BeginImplFrame callback.
146 // The scheduler will not draw more than once in a given BeginImplFrame 150 // The scheduler will not draw more than once in a given BeginImplFrame
147 // callback nor send more than one BeginMainFrame message. 151 // callback nor send more than one BeginMainFrame message.
148 void OnBeginImplFrame(); 152 void OnBeginImplFrame();
149 void OnBeginImplFrameDeadlinePending(); 153 void OnBeginImplFrameDeadlinePending();
150 // Indicates that the scheduler has entered the draw phase. The scheduler 154 // Indicates that the scheduler has entered the draw phase. The scheduler
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 void SetTreePrioritiesAndScrollState(TreePriority tree_priority, 204 void SetTreePrioritiesAndScrollState(TreePriority tree_priority,
201 ScrollHandlerState scroll_handler_state); 205 ScrollHandlerState scroll_handler_state);
202 206
203 // Indicates if the main thread will likely respond within 1 vsync. 207 // Indicates if the main thread will likely respond within 1 vsync.
204 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast); 208 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast);
205 209
206 // A function of SetTreePrioritiesAndScrollState and 210 // A function of SetTreePrioritiesAndScrollState and
207 // SetCriticalBeginMainFrameToActivateIsFast. 211 // SetCriticalBeginMainFrameToActivateIsFast.
208 bool ImplLatencyTakesPriority() const; 212 bool ImplLatencyTakesPriority() const;
209 213
210 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen.
211 void DidDrawIfPossibleCompleted(DrawResult result);
212
213 // Indicates that a new begin main frame flow needs to be performed, either 214 // Indicates that a new begin main frame flow needs to be performed, either
214 // to pull updates from the main thread to the impl, or to push deltas from 215 // to pull updates from the main thread to the impl, or to push deltas from
215 // the impl thread to main. 216 // the impl thread to main.
216 void SetNeedsBeginMainFrame(); 217 void SetNeedsBeginMainFrame();
217 bool needs_begin_main_frame() const { return needs_begin_main_frame_; } 218 bool needs_begin_main_frame() const { return needs_begin_main_frame_; }
218 219
219 // Requests a single impl frame (after the current frame if there is one 220 // Requests a single impl frame (after the current frame if there is one
220 // active). 221 // active).
221 void SetNeedsOneBeginImplFrame(); 222 void SetNeedsOneBeginImplFrame();
222 223
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 292
292 bool ShouldAnimate() const; 293 bool ShouldAnimate() const;
293 bool ShouldBeginOutputSurfaceCreation() const; 294 bool ShouldBeginOutputSurfaceCreation() const;
294 bool ShouldDraw() const; 295 bool ShouldDraw() const;
295 bool ShouldActivatePendingTree() const; 296 bool ShouldActivatePendingTree() const;
296 bool ShouldSendBeginMainFrame() const; 297 bool ShouldSendBeginMainFrame() const;
297 bool ShouldCommit() const; 298 bool ShouldCommit() const;
298 bool ShouldPrepareTiles() const; 299 bool ShouldPrepareTiles() const;
299 bool ShouldInvalidateOutputSurface() const; 300 bool ShouldInvalidateOutputSurface() const;
300 301
302 void WillDrawInternal();
303 void DidDrawInternal(DrawResult draw_result);
304
301 const SchedulerSettings settings_; 305 const SchedulerSettings settings_;
302 306
303 OutputSurfaceState output_surface_state_; 307 OutputSurfaceState output_surface_state_;
304 BeginImplFrameState begin_impl_frame_state_; 308 BeginImplFrameState begin_impl_frame_state_;
305 BeginMainFrameState begin_main_frame_state_; 309 BeginMainFrameState begin_main_frame_state_;
306 ForcedRedrawOnTimeoutState forced_redraw_state_; 310 ForcedRedrawOnTimeoutState forced_redraw_state_;
307 311
308 // These are used for tracing only. 312 // These are used for tracing only.
309 int commit_count_; 313 int commit_count_;
310 int current_frame_number_; 314 int current_frame_number_;
311 int last_frame_number_animate_performed_; 315 int last_frame_number_animate_performed_;
312 int last_frame_number_swap_performed_; 316 int last_frame_number_swap_performed_;
313 int last_frame_number_swap_requested_; 317 int last_frame_number_draw_performed_;
314 int last_frame_number_begin_main_frame_sent_; 318 int last_frame_number_begin_main_frame_sent_;
315 int last_frame_number_invalidate_output_surface_performed_; 319 int last_frame_number_invalidate_output_surface_performed_;
316 320
317 // These are used to ensure that an action only happens once per frame, 321 // These are used to ensure that an action only happens once per frame,
318 // deadline, etc. 322 // deadline, etc.
319 bool animate_funnel_; 323 bool animate_funnel_;
320 bool request_swap_funnel_; 324 bool draw_funnel_;
321 bool send_begin_main_frame_funnel_; 325 bool send_begin_main_frame_funnel_;
322 bool invalidate_output_surface_funnel_; 326 bool invalidate_output_surface_funnel_;
323 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called 327 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called
324 // and "drained" on each BeginImplFrame. If the funnel gets too full, 328 // and "drained" on each BeginImplFrame. If the funnel gets too full,
325 // we start throttling ACTION_PREPARE_TILES such that we average one 329 // we start throttling ACTION_PREPARE_TILES such that we average one
326 // PrepareTiles per BeginImplFrame. 330 // PrepareTiles per BeginImplFrame.
327 int prepare_tiles_funnel_; 331 int prepare_tiles_funnel_;
328 332
329 int consecutive_checkerboard_animations_; 333 int consecutive_checkerboard_animations_;
330 int max_pending_swaps_; 334 int max_pending_swaps_;
(...skipping 14 matching lines...) Expand all
345 TreePriority tree_priority_; 349 TreePriority tree_priority_;
346 ScrollHandlerState scroll_handler_state_; 350 ScrollHandlerState scroll_handler_state_;
347 bool critical_begin_main_frame_to_activate_is_fast_; 351 bool critical_begin_main_frame_to_activate_is_fast_;
348 bool main_thread_missed_last_deadline_; 352 bool main_thread_missed_last_deadline_;
349 bool skip_next_begin_main_frame_to_reduce_latency_; 353 bool skip_next_begin_main_frame_to_reduce_latency_;
350 bool children_need_begin_frames_; 354 bool children_need_begin_frames_;
351 bool defer_commits_; 355 bool defer_commits_;
352 bool video_needs_begin_frames_; 356 bool video_needs_begin_frames_;
353 bool last_commit_had_no_updates_; 357 bool last_commit_had_no_updates_;
354 bool wait_for_ready_to_draw_; 358 bool wait_for_ready_to_draw_;
355 bool did_request_swap_in_last_frame_; 359 bool did_draw_in_last_frame_;
356 bool did_perform_swap_in_last_draw_; 360 bool did_perform_swap_in_last_draw_;
361 DrawResult last_draw_result_;
357 362
358 private: 363 private:
359 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); 364 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
360 }; 365 };
361 366
362 } // namespace cc 367 } // namespace cc
363 368
364 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 369 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698