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

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

Issue 1133673004: cc: Heuristic for Renderer latency recovery (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase; really simplify heuristic Created 5 years, 7 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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void OnBeginImplFrameIdle(); 138 void OnBeginImplFrameIdle();
139 BeginImplFrameState begin_impl_frame_state() const { 139 BeginImplFrameState begin_impl_frame_state() const {
140 return begin_impl_frame_state_; 140 return begin_impl_frame_state_;
141 } 141 }
142 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; 142 BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const;
143 143
144 // If the main thread didn't manage to produce a new frame in time for the 144 // If the main thread didn't manage to produce a new frame in time for the
145 // impl thread to draw, it is in a high latency mode. 145 // impl thread to draw, it is in a high latency mode.
146 bool MainThreadIsInHighLatencyMode() const; 146 bool MainThreadIsInHighLatencyMode() const;
147 147
148 bool ImplThreadIsLikelyInHighLatencyMode() const {
sunnyps 2015/05/22 21:15:05 Rename this to IsSwapThrottled or similar. We are
brianderson 2015/06/30 22:03:52 Done.
149 return pending_swaps_ >= max_pending_swaps_;
150 }
151
148 // Indicates whether the LayerTreeHostImpl is visible. 152 // Indicates whether the LayerTreeHostImpl is visible.
149 void SetVisible(bool visible); 153 void SetVisible(bool visible);
150 bool visible() const { return visible_; } 154 bool visible() const { return visible_; }
151 155
152 // Indicates that a redraw is required, either due to the impl tree changing 156 // Indicates that a redraw is required, either due to the impl tree changing
153 // or the screen being damaged and simply needing redisplay. 157 // or the screen being damaged and simply needing redisplay.
154 void SetNeedsRedraw(); 158 void SetNeedsRedraw();
155 bool needs_redraw() const { return needs_redraw_; } 159 bool needs_redraw() const { return needs_redraw_; }
156 160
157 void SetNeedsAnimate(); 161 void SetNeedsAnimate();
(...skipping 28 matching lines...) Expand all
186 return impl_latency_takes_priority_; 190 return impl_latency_takes_priority_;
187 } 191 }
188 192
189 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. 193 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen.
190 void DidDrawIfPossibleCompleted(DrawResult result); 194 void DidDrawIfPossibleCompleted(DrawResult result);
191 195
192 // Indicates that a new commit flow needs to be performed, either to pull 196 // Indicates that a new commit flow needs to be performed, either to pull
193 // updates from the main thread to the impl, or to push deltas from the impl 197 // updates from the main thread to the impl, or to push deltas from the impl
194 // thread to main. 198 // thread to main.
195 void SetNeedsCommit(); 199 void SetNeedsCommit();
200 bool needs_commit() const { return needs_commit_; }
196 201
197 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME 202 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME
198 // from NextAction. 203 // from NextAction.
199 // Indicates that all painting is complete. 204 // Indicates that all painting is complete.
200 void NotifyReadyToCommit(); 205 void NotifyReadyToCommit();
201 206
202 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME 207 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME
203 // from NextAction if the client rejects the BeginMainFrame message. 208 // from NextAction if the client rejects the BeginMainFrame message.
204 void BeginMainFrameAborted(CommitEarlyOutReason reason); 209 void BeginMainFrameAborted(CommitEarlyOutReason reason);
205 210
206 // Set that we can create the first OutputSurface and start the scheduler. 211 // Set that we can create the first OutputSurface and start the scheduler.
207 void SetCanStart() { can_start_ = true; } 212 void SetCanStart() { can_start_ = true; }
208 // Allow access of the can_start_ state in tests. 213 // Allow access of the can_start_ state in tests.
209 bool CanStartForTesting() const { return can_start_; } 214 bool CanStartForTesting() const { return can_start_; }
210 215
216 // Indicates production should be skipped to recover latency.
211 void SetSkipNextBeginMainFrameToReduceLatency(); 217 void SetSkipNextBeginMainFrameToReduceLatency();
212 218
213 // Indicates whether drawing would, at this time, make sense. 219 // Indicates whether drawing would, at this time, make sense.
214 // CanDraw can be used to suppress flashes or checkerboarding 220 // CanDraw can be used to suppress flashes or checkerboarding
215 // when such behavior would be undesirable. 221 // when such behavior would be undesirable.
216 void SetCanDraw(bool can); 222 void SetCanDraw(bool can);
217 223
218 // Indicates that scheduled BeginMainFrame is started. 224 // Indicates that scheduled BeginMainFrame is started.
219 void NotifyBeginMainFrameStarted(); 225 void NotifyBeginMainFrameStarted();
220 226
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 bool needs_commit_; 332 bool needs_commit_;
327 bool visible_; 333 bool visible_;
328 bool can_start_; 334 bool can_start_;
329 bool can_draw_; 335 bool can_draw_;
330 bool has_pending_tree_; 336 bool has_pending_tree_;
331 bool pending_tree_is_ready_for_activation_; 337 bool pending_tree_is_ready_for_activation_;
332 bool active_tree_needs_first_draw_; 338 bool active_tree_needs_first_draw_;
333 bool did_create_and_initialize_first_output_surface_; 339 bool did_create_and_initialize_first_output_surface_;
334 bool impl_latency_takes_priority_; 340 bool impl_latency_takes_priority_;
335 bool skip_next_begin_main_frame_to_reduce_latency_; 341 bool skip_next_begin_main_frame_to_reduce_latency_;
336 bool skip_begin_main_frame_to_reduce_latency_;
337 bool continuous_painting_; 342 bool continuous_painting_;
338 bool children_need_begin_frames_; 343 bool children_need_begin_frames_;
339 bool defer_commits_; 344 bool defer_commits_;
340 bool video_needs_begin_frames_; 345 bool video_needs_begin_frames_;
341 bool last_commit_had_no_updates_; 346 bool last_commit_had_no_updates_;
342 bool wait_for_active_tree_ready_to_draw_; 347 bool wait_for_active_tree_ready_to_draw_;
343 bool did_request_swap_in_last_frame_; 348 bool did_request_swap_in_last_frame_;
344 bool did_perform_swap_in_last_draw_; 349 bool did_perform_swap_in_last_draw_;
345 350
346 private: 351 private:
347 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); 352 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
348 }; 353 };
349 354
350 } // namespace cc 355 } // namespace cc
351 356
352 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 357 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698