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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 ~Scheduler() override; | 92 ~Scheduler() override; |
93 | 93 |
94 // BeginFrameObserverMixin | 94 // BeginFrameObserverMixin |
95 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; | 95 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; |
96 | 96 |
97 void OnDrawForOutputSurface(); | 97 void OnDrawForOutputSurface(); |
98 | 98 |
99 const SchedulerSettings& settings() const { return settings_; } | 99 const SchedulerSettings& settings() const { return settings_; } |
100 | 100 |
| 101 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); |
101 void CommitVSyncParameters(base::TimeTicks timebase, | 102 void CommitVSyncParameters(base::TimeTicks timebase, |
102 base::TimeDelta interval); | 103 base::TimeDelta interval); |
103 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); | 104 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); |
104 | 105 |
105 void SetCanStart(); | 106 void SetCanStart(); |
106 | 107 |
107 void SetVisible(bool visible); | 108 void SetVisible(bool visible); |
108 void SetCanDraw(bool can_draw); | 109 void SetCanDraw(bool can_draw); |
109 void NotifyReadyToActivate(); | 110 void NotifyReadyToActivate(); |
110 void NotifyReadyToDraw(); | 111 void NotifyReadyToDraw(); |
(...skipping 27 matching lines...) Expand all Loading... |
138 bool MainFrameForTestingWillHappen() const { | 139 bool MainFrameForTestingWillHappen() const { |
139 return state_machine_.CommitPending() || | 140 return state_machine_.CommitPending() || |
140 state_machine_.CouldSendBeginMainFrame(); | 141 state_machine_.CouldSendBeginMainFrame(); |
141 } | 142 } |
142 | 143 |
143 bool CommitPending() const { return state_machine_.CommitPending(); } | 144 bool CommitPending() const { return state_machine_.CommitPending(); } |
144 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 145 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
145 bool PrepareTilesPending() const { | 146 bool PrepareTilesPending() const { |
146 return state_machine_.PrepareTilesPending(); | 147 return state_machine_.PrepareTilesPending(); |
147 } | 148 } |
148 bool MainThreadIsInHighLatencyMode() const { | |
149 return state_machine_.MainThreadIsInHighLatencyMode(); | |
150 } | |
151 bool BeginImplFrameDeadlinePending() const { | 149 bool BeginImplFrameDeadlinePending() const { |
152 return !begin_impl_frame_deadline_task_.IsCancelled(); | 150 return !begin_impl_frame_deadline_task_.IsCancelled(); |
153 } | 151 } |
154 | 152 |
155 base::TimeTicks AnticipatedDrawTime() const; | 153 base::TimeTicks AnticipatedDrawTime() const; |
156 | 154 |
157 void NotifyBeginMainFrameStarted(); | 155 void NotifyBeginMainFrameStarted(); |
158 | 156 |
159 base::TimeTicks LastBeginImplFrameTime(); | 157 base::TimeTicks LastBeginImplFrameTime(); |
160 | 158 |
161 void SetDeferCommits(bool defer_commits); | 159 void SetDeferCommits(bool defer_commits); |
162 | 160 |
163 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 161 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
164 void AsValueInto(base::trace_event::TracedValue* value) const override; | 162 void AsValueInto(base::trace_event::TracedValue* value) const override; |
165 | 163 |
166 void SetContinuousPainting(bool continuous_painting) { | 164 void SetContinuousPainting(bool continuous_painting) { |
167 state_machine_.SetContinuousPainting(continuous_painting); | 165 state_machine_.SetContinuousPainting(continuous_painting); |
168 } | 166 } |
169 | 167 |
170 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); | 168 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); |
171 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); | 169 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); |
172 | 170 |
173 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); | |
174 | |
175 protected: | 171 protected: |
176 Scheduler(SchedulerClient* client, | 172 Scheduler(SchedulerClient* client, |
177 const SchedulerSettings& scheduler_settings, | 173 const SchedulerSettings& scheduler_settings, |
178 int layer_tree_host_id, | 174 int layer_tree_host_id, |
179 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 175 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
180 scoped_ptr<BeginFrameSource> external_begin_frame_source, | 176 scoped_ptr<BeginFrameSource> external_begin_frame_source, |
181 SchedulerFrameSourcesConstructor* frame_sources_constructor); | 177 SchedulerFrameSourcesConstructor* frame_sources_constructor); |
182 | 178 |
183 // virtual for testing - Don't call these in the constructor or | 179 // virtual for testing - Don't call these in the constructor or |
184 // destructor! | 180 // destructor! |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 219 |
224 private: | 220 private: |
225 void ScheduleBeginImplFrameDeadline(); | 221 void ScheduleBeginImplFrameDeadline(); |
226 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 222 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
227 void SetupNextBeginFrameIfNeeded(); | 223 void SetupNextBeginFrameIfNeeded(); |
228 void PostBeginRetroFrameIfNeeded(); | 224 void PostBeginRetroFrameIfNeeded(); |
229 void SetupPollingMechanisms(); | 225 void SetupPollingMechanisms(); |
230 void DrawAndSwapIfPossible(); | 226 void DrawAndSwapIfPossible(); |
231 void ProcessScheduledActions(); | 227 void ProcessScheduledActions(); |
232 bool CanCommitAndActivateBeforeDeadline() const; | 228 bool CanCommitAndActivateBeforeDeadline() const; |
| 229 bool CanDrawBeforeDeadline() const; |
233 void AdvanceCommitStateIfPossible(); | 230 void AdvanceCommitStateIfPossible(); |
234 bool IsBeginMainFrameSentOrStarted() const; | 231 bool IsBeginMainFrameSentOrStarted() const; |
235 void BeginRetroFrame(); | 232 void BeginRetroFrame(); |
236 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 233 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
237 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 234 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
238 void BeginImplFrame(); | 235 void BeginImplFrame(); |
239 void FinishImplFrame(); | 236 void FinishImplFrame(); |
240 void OnBeginImplFrameDeadline(); | 237 void OnBeginImplFrameDeadline(); |
241 void PollToAdvanceCommitState(); | 238 void PollToAdvanceCommitState(); |
242 | 239 |
243 base::TimeDelta EstimatedParentDrawTime() { | 240 base::TimeDelta EstimatedParentDrawTime() { |
244 return estimated_parent_draw_time_; | 241 return estimated_parent_draw_time_; |
245 } | 242 } |
246 | 243 |
247 bool IsInsideAction(SchedulerStateMachine::Action action) { | 244 bool IsInsideAction(SchedulerStateMachine::Action action) { |
248 return inside_action_ == action; | 245 return inside_action_ == action; |
249 } | 246 } |
250 | 247 |
251 base::WeakPtrFactory<Scheduler> weak_factory_; | 248 base::WeakPtrFactory<Scheduler> weak_factory_; |
252 | 249 |
253 friend class SchedulerFrameSourcesConstructor; | 250 friend class SchedulerFrameSourcesConstructor; |
254 friend class TestSchedulerFrameSourcesConstructor; | 251 friend class TestSchedulerFrameSourcesConstructor; |
255 | 252 |
256 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 253 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
257 }; | 254 }; |
258 | 255 |
259 } // namespace cc | 256 } // namespace cc |
260 | 257 |
261 #endif // CC_SCHEDULER_SCHEDULER_H_ | 258 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |