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

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

Issue 54913003: Scheduler: Switch from high to low latency mode if possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // callback nor send more than one BeginMainFrame message. 139 // callback nor send more than one BeginMainFrame message.
140 void OnBeginImplFrame(const BeginFrameArgs& args); 140 void OnBeginImplFrame(const BeginFrameArgs& args);
141 void OnBeginImplFrameDeadlinePending(); 141 void OnBeginImplFrameDeadlinePending();
142 void OnBeginImplFrameDeadline(); 142 void OnBeginImplFrameDeadline();
143 void OnBeginImplFrameIdle(); 143 void OnBeginImplFrameIdle();
144 bool ShouldTriggerBeginImplFrameDeadlineEarly() const; 144 bool ShouldTriggerBeginImplFrameDeadlineEarly() const;
145 BeginImplFrameState begin_impl_frame_state() const { 145 BeginImplFrameState begin_impl_frame_state() const {
146 return begin_impl_frame_state_; 146 return begin_impl_frame_state_;
147 } 147 }
148 148
149 // If there's something to draw on BeginImplFrame the impl thread is lagging
150 // behind the main thread. We're thus in high latency mode.
brianderson 2013/11/01 00:22:59 "the main thread is lagging behind the impl thread
Dominik Grewe 2013/11/01 17:09:14 But the main thread is one frame ahead, isn't it?
brianderson 2013/11/01 21:18:30 The main thread gets into a high latency mode by b
151 bool InHighLatencyMode() const;
152
149 // PollForAnticipatedDrawTriggers is used by the synchronous compositor to 153 // PollForAnticipatedDrawTriggers is used by the synchronous compositor to
150 // avoid requesting BeginImplFrames when we won't actually draw but still 154 // avoid requesting BeginImplFrames when we won't actually draw but still
151 // need to advance our state at vsync intervals. 155 // need to advance our state at vsync intervals.
152 void DidEnterPollForAnticipatedDrawTriggers(); 156 void DidEnterPollForAnticipatedDrawTriggers();
153 void DidLeavePollForAnticipatedDrawTriggers(); 157 void DidLeavePollForAnticipatedDrawTriggers();
154 bool inside_poll_for_anticipated_draw_triggers() const { 158 bool inside_poll_for_anticipated_draw_triggers() const {
155 return inside_poll_for_anticipated_draw_triggers_; 159 return inside_poll_for_anticipated_draw_triggers_;
156 } 160 }
157 161
158 // Indicates whether the LayerTreeHostImpl is visible. 162 // Indicates whether the LayerTreeHostImpl is visible.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // Request exclusive access to the textures that back single buffered 206 // Request exclusive access to the textures that back single buffered
203 // layers on behalf of the main thread. Upon acquisition, 207 // layers on behalf of the main thread. Upon acquisition,
204 // ACTION_DRAW_AND_SWAP_IF_POSSIBLE will not draw until the main thread 208 // ACTION_DRAW_AND_SWAP_IF_POSSIBLE will not draw until the main thread
205 // releases the 209 // releases the
206 // textures to the impl thread by committing the layers. 210 // textures to the impl thread by committing the layers.
207 void SetMainThreadNeedsLayerTextures(); 211 void SetMainThreadNeedsLayerTextures();
208 212
209 // Set that we can create the first OutputSurface and start the scheduler. 213 // Set that we can create the first OutputSurface and start the scheduler.
210 void SetCanStart() { can_start_ = true; } 214 void SetCanStart() { can_start_ = true; }
211 215
216 void SetSkipBeginMainFrame(bool skip);
brianderson 2013/11/01 00:22:59 SkipNextBeginMainFrame()? Actually, nevermind; th
217
212 // Indicates whether drawing would, at this time, make sense. 218 // Indicates whether drawing would, at this time, make sense.
213 // CanDraw can be used to supress flashes or checkerboarding 219 // CanDraw can be used to supress flashes or checkerboarding
214 // when such behavior would be undesirable. 220 // when such behavior would be undesirable.
215 void SetCanDraw(bool can); 221 void SetCanDraw(bool can);
216 222
217 // Indicates that the pending tree is ready for activation. 223 // Indicates that the pending tree is ready for activation.
218 void NotifyReadyToActivate(); 224 void NotifyReadyToActivate();
219 225
220 bool has_pending_tree() const { return has_pending_tree_; } 226 bool has_pending_tree() const { return has_pending_tree_; }
221 227
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 bool inside_poll_for_anticipated_draw_triggers_; 287 bool inside_poll_for_anticipated_draw_triggers_;
282 bool visible_; 288 bool visible_;
283 bool can_start_; 289 bool can_start_;
284 bool can_draw_; 290 bool can_draw_;
285 bool has_pending_tree_; 291 bool has_pending_tree_;
286 bool pending_tree_is_ready_for_activation_; 292 bool pending_tree_is_ready_for_activation_;
287 bool active_tree_needs_first_draw_; 293 bool active_tree_needs_first_draw_;
288 bool draw_if_possible_failed_; 294 bool draw_if_possible_failed_;
289 bool did_create_and_initialize_first_output_surface_; 295 bool did_create_and_initialize_first_output_surface_;
290 bool smoothness_takes_priority_; 296 bool smoothness_takes_priority_;
297 bool skip_begin_main_frame_;
brianderson 2013/11/01 00:22:59 skip_begin_main_frame_to_reduce_latency_
Dominik Grewe 2013/11/01 17:09:14 Done. Also changed the name of the corresponding s
291 298
292 private: 299 private:
293 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); 300 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
294 }; 301 };
295 302
296 } // namespace cc 303 } // namespace cc
297 304
298 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ 305 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698