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

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

Issue 2753843003: Create a new action triggered when a BeginMainFrame is not expected before vsync (Closed)
Patch Set: Never schedule idle work if we're already scheduling a main frame Created 3 years, 9 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
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 ACTION_SEND_BEGIN_MAIN_FRAME, 116 ACTION_SEND_BEGIN_MAIN_FRAME,
117 ACTION_COMMIT, 117 ACTION_COMMIT,
118 ACTION_ACTIVATE_SYNC_TREE, 118 ACTION_ACTIVATE_SYNC_TREE,
119 ACTION_PERFORM_IMPL_SIDE_INVALIDATION, 119 ACTION_PERFORM_IMPL_SIDE_INVALIDATION,
120 ACTION_DRAW_IF_POSSIBLE, 120 ACTION_DRAW_IF_POSSIBLE,
121 ACTION_DRAW_FORCED, 121 ACTION_DRAW_FORCED,
122 ACTION_DRAW_ABORT, 122 ACTION_DRAW_ABORT,
123 ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION, 123 ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION,
124 ACTION_PREPARE_TILES, 124 ACTION_PREPARE_TILES,
125 ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK, 125 ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK,
126 ACTION_DO_IDLE_WORK,
126 }; 127 };
127 static const char* ActionToString(Action action); 128 static const char* ActionToString(Action action);
128 129
129 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 130 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
130 void AsValueInto(base::trace_event::TracedValue* dict) const; 131 void AsValueInto(base::trace_event::TracedValue* dict) const;
131 132
132 Action NextAction() const; 133 Action NextAction() const;
133 void WillSendBeginMainFrame(); 134 void WillSendBeginMainFrame();
135 void WillDoIdleWork();
134 void WillCommit(bool commit_had_no_updates); 136 void WillCommit(bool commit_had_no_updates);
135 void WillActivate(); 137 void WillActivate();
136 void WillDraw(); 138 void WillDraw();
137 void WillBeginCompositorFrameSinkCreation(); 139 void WillBeginCompositorFrameSinkCreation();
138 void WillPrepareTiles(); 140 void WillPrepareTiles();
139 void WillInvalidateCompositorFrameSink(); 141 void WillInvalidateCompositorFrameSink();
140 void WillPerformImplSideInvalidation(); 142 void WillPerformImplSideInvalidation();
141 143
142 void DidDraw(DrawResult draw_result); 144 void DidDraw(DrawResult draw_result);
143 145
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 269
268 void DidPrepareTiles(); 270 void DidPrepareTiles();
269 void DidLoseCompositorFrameSink(); 271 void DidLoseCompositorFrameSink();
270 void DidCreateAndInitializeCompositorFrameSink(); 272 void DidCreateAndInitializeCompositorFrameSink();
271 bool HasInitializedCompositorFrameSink() const; 273 bool HasInitializedCompositorFrameSink() const;
272 274
273 // True if we need to abort draws to make forward progress. 275 // True if we need to abort draws to make forward progress.
274 bool PendingDrawsShouldBeAborted() const; 276 bool PendingDrawsShouldBeAborted() const;
275 277
276 bool CouldSendBeginMainFrame() const; 278 bool CouldSendBeginMainFrame() const;
279 bool CouldDoIdleWork() const;
277 280
278 void SetDeferCommits(bool defer_commits); 281 void SetDeferCommits(bool defer_commits);
279 282
280 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); 283 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames);
281 bool video_needs_begin_frames() const { return video_needs_begin_frames_; } 284 bool video_needs_begin_frames() const { return video_needs_begin_frames_; }
282 285
283 bool did_submit_in_last_frame() const { return did_submit_in_last_frame_; } 286 bool did_submit_in_last_frame() const { return did_submit_in_last_frame_; }
284 287
285 bool needs_impl_side_invalidation() const { 288 bool needs_impl_side_invalidation() const {
286 return needs_impl_side_invalidation_; 289 return needs_impl_side_invalidation_;
(...skipping 24 matching lines...) Expand all
311 // TODO(sunnyps): Rename this to ShouldAbortCurrentFrame or similar. 314 // TODO(sunnyps): Rename this to ShouldAbortCurrentFrame or similar.
312 bool PendingActivationsShouldBeForced() const; 315 bool PendingActivationsShouldBeForced() const;
313 316
314 bool ShouldBeginCompositorFrameSinkCreation() const; 317 bool ShouldBeginCompositorFrameSinkCreation() const;
315 bool ShouldDraw() const; 318 bool ShouldDraw() const;
316 bool ShouldActivatePendingTree() const; 319 bool ShouldActivatePendingTree() const;
317 bool ShouldSendBeginMainFrame() const; 320 bool ShouldSendBeginMainFrame() const;
318 bool ShouldCommit() const; 321 bool ShouldCommit() const;
319 bool ShouldPrepareTiles() const; 322 bool ShouldPrepareTiles() const;
320 bool ShouldInvalidateCompositorFrameSink() const; 323 bool ShouldInvalidateCompositorFrameSink() const;
324 bool ShouldDoIdleWork() const;
321 325
322 void WillDrawInternal(); 326 void WillDrawInternal();
323 void WillPerformImplSideInvalidationInternal(); 327 void WillPerformImplSideInvalidationInternal();
324 void DidDrawInternal(DrawResult draw_result); 328 void DidDrawInternal(DrawResult draw_result);
325 329
326 void UpdateBeginFrameSequenceNumbersForBeginFrame(uint32_t source_id, 330 void UpdateBeginFrameSequenceNumbersForBeginFrame(uint32_t source_id,
327 uint64_t sequence_number); 331 uint64_t sequence_number);
328 void UpdateBeginFrameSequenceNumbersForBeginFrameDeadline(); 332 void UpdateBeginFrameSequenceNumbersForBeginFrameDeadline();
329 333
330 const SchedulerSettings settings_; 334 const SchedulerSettings settings_;
(...skipping 21 matching lines...) Expand all
352 int last_frame_number_draw_performed_; 356 int last_frame_number_draw_performed_;
353 int last_frame_number_begin_main_frame_sent_; 357 int last_frame_number_begin_main_frame_sent_;
354 int last_frame_number_invalidate_compositor_frame_sink_performed_; 358 int last_frame_number_invalidate_compositor_frame_sink_performed_;
355 359
356 // These are used to ensure that an action only happens once per frame, 360 // These are used to ensure that an action only happens once per frame,
357 // deadline, etc. 361 // deadline, etc.
358 bool draw_funnel_; 362 bool draw_funnel_;
359 bool send_begin_main_frame_funnel_; 363 bool send_begin_main_frame_funnel_;
360 bool invalidate_compositor_frame_sink_funnel_; 364 bool invalidate_compositor_frame_sink_funnel_;
361 bool impl_side_invalidation_funnel_; 365 bool impl_side_invalidation_funnel_;
366 bool do_idle_work_funnel_;
362 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called 367 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called
363 // and "drained" on each BeginImplFrame. If the funnel gets too full, 368 // and "drained" on each BeginImplFrame. If the funnel gets too full,
364 // we start throttling ACTION_PREPARE_TILES such that we average one 369 // we start throttling ACTION_PREPARE_TILES such that we average one
365 // PrepareTiles per BeginImplFrame. 370 // PrepareTiles per BeginImplFrame.
366 int prepare_tiles_funnel_; 371 int prepare_tiles_funnel_;
367 372
368 int consecutive_checkerboard_animations_; 373 int consecutive_checkerboard_animations_;
369 int pending_submit_frames_; 374 int pending_submit_frames_;
370 int submit_frames_with_current_compositor_frame_sink_; 375 int submit_frames_with_current_compositor_frame_sink_;
371 bool needs_redraw_; 376 bool needs_redraw_;
(...skipping 24 matching lines...) Expand all
396 bool previous_pending_tree_was_impl_side_; 401 bool previous_pending_tree_was_impl_side_;
397 bool current_pending_tree_is_impl_side_; 402 bool current_pending_tree_is_impl_side_;
398 403
399 private: 404 private:
400 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); 405 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
401 }; 406 };
402 407
403 } // namespace cc 408 } // namespace cc
404 409
405 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 410 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698