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

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

Issue 1133673004: cc: Heuristic for Renderer latency recovery (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | cc/scheduler/scheduler.cc » ('j') | cc/scheduler/scheduler.cc » ('J')
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_H_ 5 #ifndef CC_SCHEDULER_SCHEDULER_H_
6 #define CC_SCHEDULER_SCHEDULER_H_ 6 #define CC_SCHEDULER_SCHEDULER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 ~Scheduler() override; 93 ~Scheduler() override;
94 94
95 // BeginFrameObserverMixin 95 // BeginFrameObserverMixin
96 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; 96 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override;
97 97
98 void OnDrawForOutputSurface(); 98 void OnDrawForOutputSurface();
99 99
100 const SchedulerSettings& settings() const { return settings_; } 100 const SchedulerSettings& settings() const { return settings_; }
101 101
102 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval);
102 void CommitVSyncParameters(base::TimeTicks timebase, 103 void CommitVSyncParameters(base::TimeTicks timebase,
103 base::TimeDelta interval); 104 base::TimeDelta interval);
104 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); 105 void SetEstimatedParentDrawTime(base::TimeDelta draw_time);
105 106
106 void SetCanStart(); 107 void SetCanStart();
107 108
108 void SetVisible(bool visible); 109 void SetVisible(bool visible);
109 void SetCanDraw(bool can_draw); 110 void SetCanDraw(bool can_draw);
110 void NotifyReadyToActivate(); 111 void NotifyReadyToActivate();
111 void NotifyReadyToDraw(); 112 void NotifyReadyToDraw();
(...skipping 27 matching lines...) Expand all
139 bool MainFrameForTestingWillHappen() const { 140 bool MainFrameForTestingWillHappen() const {
140 return state_machine_.CommitPending() || 141 return state_machine_.CommitPending() ||
141 state_machine_.CouldSendBeginMainFrame(); 142 state_machine_.CouldSendBeginMainFrame();
142 } 143 }
143 144
144 bool CommitPending() const { return state_machine_.CommitPending(); } 145 bool CommitPending() const { return state_machine_.CommitPending(); }
145 bool RedrawPending() const { return state_machine_.RedrawPending(); } 146 bool RedrawPending() const { return state_machine_.RedrawPending(); }
146 bool PrepareTilesPending() const { 147 bool PrepareTilesPending() const {
147 return state_machine_.PrepareTilesPending(); 148 return state_machine_.PrepareTilesPending();
148 } 149 }
149 bool MainThreadIsInHighLatencyMode() const {
150 return state_machine_.MainThreadIsInHighLatencyMode();
151 }
152 bool BeginImplFrameDeadlinePending() const {
153 return !begin_impl_frame_deadline_task_.IsCancelled();
154 }
155 150
156 base::TimeTicks AnticipatedDrawTime() const; 151 base::TimeTicks AnticipatedDrawTime() const;
157 152
158 void NotifyBeginMainFrameStarted(); 153 void NotifyBeginMainFrameStarted();
159 154
160 base::TimeTicks LastBeginImplFrameTime(); 155 base::TimeTicks LastBeginImplFrameTime();
161 156
162 void SetDeferCommits(bool defer_commits); 157 void SetDeferCommits(bool defer_commits);
163 158
164 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 159 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
165 void AsValueInto(base::trace_event::TracedValue* value) const override; 160 void AsValueInto(base::trace_event::TracedValue* value) const override;
166 161
167 void SetContinuousPainting(bool continuous_painting) { 162 void SetContinuousPainting(bool continuous_painting) {
168 state_machine_.SetContinuousPainting(continuous_painting); 163 state_machine_.SetContinuousPainting(continuous_painting);
169 } 164 }
170 165
171 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); 166 void SetChildrenNeedBeginFrames(bool children_need_begin_frames);
172 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); 167 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames);
173 168
174 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval);
175
176 protected: 169 protected:
177 Scheduler(SchedulerClient* client, 170 Scheduler(SchedulerClient* client,
178 const SchedulerSettings& scheduler_settings, 171 const SchedulerSettings& scheduler_settings,
179 int layer_tree_host_id, 172 int layer_tree_host_id,
180 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 173 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
181 scoped_ptr<BeginFrameSource> external_begin_frame_source, 174 scoped_ptr<BeginFrameSource> external_begin_frame_source,
182 SchedulerFrameSourcesConstructor* frame_sources_constructor); 175 SchedulerFrameSourcesConstructor* frame_sources_constructor);
183 176
184 // virtual for testing - Don't call these in the constructor or 177 // virtual for testing - Don't call these in the constructor or
185 // destructor! 178 // destructor!
(...skipping 29 matching lines...) Expand all
215 base::Closure begin_impl_frame_deadline_closure_; 208 base::Closure begin_impl_frame_deadline_closure_;
216 base::Closure advance_commit_state_closure_; 209 base::Closure advance_commit_state_closure_;
217 base::CancelableClosure begin_retro_frame_task_; 210 base::CancelableClosure begin_retro_frame_task_;
218 base::CancelableClosure begin_impl_frame_deadline_task_; 211 base::CancelableClosure begin_impl_frame_deadline_task_;
219 base::CancelableClosure advance_commit_state_task_; 212 base::CancelableClosure advance_commit_state_task_;
220 213
221 SchedulerStateMachine state_machine_; 214 SchedulerStateMachine state_machine_;
222 bool inside_process_scheduled_actions_; 215 bool inside_process_scheduled_actions_;
223 SchedulerStateMachine::Action inside_action_; 216 SchedulerStateMachine::Action inside_action_;
224 217
218 protected:
219 bool BeginImplFrameDeadlinePending() const {
220 return !begin_impl_frame_deadline_task_.IsCancelled();
221 }
222
225 private: 223 private:
226 void ScheduleBeginImplFrameDeadline(); 224 void ScheduleBeginImplFrameDeadline();
227 void ScheduleBeginImplFrameDeadlineIfNeeded(); 225 void ScheduleBeginImplFrameDeadlineIfNeeded();
228 void SetupNextBeginFrameIfNeeded(); 226 void SetupNextBeginFrameIfNeeded();
229 void PostBeginRetroFrameIfNeeded(); 227 void PostBeginRetroFrameIfNeeded();
230 void SetupPollingMechanisms(); 228 void SetupPollingMechanisms();
231 void DrawAndSwapIfPossible(); 229 void DrawAndSwapIfPossible();
232 void ProcessScheduledActions(); 230 void ProcessScheduledActions();
233 bool CanCommitAndActivateBeforeDeadline() const; 231 bool CanCommitAndActivateBeforeDeadline() const;
232 bool CanDrawBeforeDeadline() const;
234 void AdvanceCommitStateIfPossible(); 233 void AdvanceCommitStateIfPossible();
235 bool IsBeginMainFrameSentOrStarted() const; 234 bool IsBeginMainFrameSentOrStarted() const;
236 void BeginRetroFrame(); 235 void BeginRetroFrame();
237 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); 236 void BeginImplFrameWithDeadline(const BeginFrameArgs& args);
238 void BeginImplFrameSynchronous(const BeginFrameArgs& args); 237 void BeginImplFrameSynchronous(const BeginFrameArgs& args);
239 void BeginImplFrame(); 238 void BeginImplFrame();
240 void FinishImplFrame(); 239 void FinishImplFrame();
241 void OnBeginImplFrameDeadline(); 240 void OnBeginImplFrameDeadline();
241
242 void PollToAdvanceCommitState(); 242 void PollToAdvanceCommitState();
243 243
244 base::TimeDelta EstimatedParentDrawTime() { 244 base::TimeDelta EstimatedParentDrawTime() {
245 return estimated_parent_draw_time_; 245 return estimated_parent_draw_time_;
246 } 246 }
247 247
248 bool IsInsideAction(SchedulerStateMachine::Action action) { 248 bool IsInsideAction(SchedulerStateMachine::Action action) {
249 return inside_action_ == action; 249 return inside_action_ == action;
250 } 250 }
251 251
252 base::WeakPtrFactory<Scheduler> weak_factory_; 252 base::WeakPtrFactory<Scheduler> weak_factory_;
253 253
254 friend class SchedulerFrameSourcesConstructor; 254 friend class SchedulerFrameSourcesConstructor;
255 friend class TestSchedulerFrameSourcesConstructor; 255 friend class TestSchedulerFrameSourcesConstructor;
256 256
257 DISALLOW_COPY_AND_ASSIGN(Scheduler); 257 DISALLOW_COPY_AND_ASSIGN(Scheduler);
258 }; 258 };
259 259
260 } // namespace cc 260 } // namespace cc
261 261
262 #endif // CC_SCHEDULER_SCHEDULER_H_ 262 #endif // CC_SCHEDULER_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/scheduler/scheduler.cc » ('j') | cc/scheduler/scheduler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698