OLD | NEW |
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 Loading... |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 165 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
165 void AsValueInto(base::trace_event::TracedValue* value) const override; | 166 void AsValueInto(base::trace_event::TracedValue* value) const override; |
166 | 167 |
167 void SetContinuousPainting(bool continuous_painting) { | 168 void SetContinuousPainting(bool continuous_painting) { |
168 state_machine_.SetContinuousPainting(continuous_painting); | 169 state_machine_.SetContinuousPainting(continuous_painting); |
169 } | 170 } |
170 | 171 |
171 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); | 172 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); |
172 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); | 173 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); |
173 | 174 |
174 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); | |
175 | |
176 protected: | 175 protected: |
177 Scheduler(SchedulerClient* client, | 176 Scheduler(SchedulerClient* client, |
178 const SchedulerSettings& scheduler_settings, | 177 const SchedulerSettings& scheduler_settings, |
179 int layer_tree_host_id, | 178 int layer_tree_host_id, |
180 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 179 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
181 scoped_ptr<BeginFrameSource> external_begin_frame_source, | 180 scoped_ptr<BeginFrameSource> external_begin_frame_source, |
182 SchedulerFrameSourcesConstructor* frame_sources_constructor); | 181 SchedulerFrameSourcesConstructor* frame_sources_constructor); |
183 | 182 |
184 // virtual for testing - Don't call these in the constructor or | 183 // virtual for testing - Don't call these in the constructor or |
185 // destructor! | 184 // destructor! |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 223 |
225 private: | 224 private: |
226 void ScheduleBeginImplFrameDeadline(); | 225 void ScheduleBeginImplFrameDeadline(); |
227 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 226 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
228 void SetupNextBeginFrameIfNeeded(); | 227 void SetupNextBeginFrameIfNeeded(); |
229 void PostBeginRetroFrameIfNeeded(); | 228 void PostBeginRetroFrameIfNeeded(); |
230 void SetupPollingMechanisms(); | 229 void SetupPollingMechanisms(); |
231 void DrawAndSwapIfPossible(); | 230 void DrawAndSwapIfPossible(); |
232 void ProcessScheduledActions(); | 231 void ProcessScheduledActions(); |
233 bool CanCommitAndActivateBeforeDeadline() const; | 232 bool CanCommitAndActivateBeforeDeadline() const; |
| 233 bool CanDrawBeforeDeadline() const; |
234 void AdvanceCommitStateIfPossible(); | 234 void AdvanceCommitStateIfPossible(); |
235 bool IsBeginMainFrameSentOrStarted() const; | 235 bool IsBeginMainFrameSentOrStarted() const; |
236 void BeginRetroFrame(); | 236 void BeginRetroFrame(); |
237 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 237 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
238 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 238 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
239 void BeginImplFrame(); | 239 void BeginImplFrame(); |
240 void FinishImplFrame(); | 240 void FinishImplFrame(); |
241 void OnBeginImplFrameDeadline(); | 241 void OnBeginImplFrameDeadline(); |
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_ |
OLD | NEW |