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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 bool MainFrameForTestingWillHappen() const { | 113 bool MainFrameForTestingWillHappen() const { |
114 return state_machine_.CommitPending() || | 114 return state_machine_.CommitPending() || |
115 state_machine_.CouldSendBeginMainFrame(); | 115 state_machine_.CouldSendBeginMainFrame(); |
116 } | 116 } |
117 | 117 |
118 bool CommitPending() const { return state_machine_.CommitPending(); } | 118 bool CommitPending() const { return state_machine_.CommitPending(); } |
119 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 119 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
120 bool PrepareTilesPending() const { | 120 bool PrepareTilesPending() const { |
121 return state_machine_.PrepareTilesPending(); | 121 return state_machine_.PrepareTilesPending(); |
122 } | 122 } |
123 bool MainThreadIsInHighLatencyMode() const { | |
124 return state_machine_.MainThreadIsInHighLatencyMode(); | |
125 } | |
126 bool BeginImplFrameDeadlinePending() const { | 123 bool BeginImplFrameDeadlinePending() const { |
127 return !begin_impl_frame_deadline_task_.IsCancelled(); | 124 return !begin_impl_frame_deadline_task_.IsCancelled(); |
128 } | 125 } |
129 bool ImplLatencyTakesPriority() const { | 126 bool ImplLatencyTakesPriority() const { |
130 return state_machine_.impl_latency_takes_priority(); | 127 return state_machine_.impl_latency_takes_priority(); |
131 } | 128 } |
132 | 129 |
133 void NotifyBeginMainFrameStarted(); | 130 void NotifyBeginMainFrameStarted(); |
134 | 131 |
135 base::TimeTicks LastBeginImplFrameTime(); | 132 base::TimeTicks LastBeginImplFrameTime(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 | 182 |
186 base::Closure begin_retro_frame_closure_; | 183 base::Closure begin_retro_frame_closure_; |
187 base::Closure begin_impl_frame_deadline_closure_; | 184 base::Closure begin_impl_frame_deadline_closure_; |
188 base::CancelableClosure begin_retro_frame_task_; | 185 base::CancelableClosure begin_retro_frame_task_; |
189 base::CancelableClosure begin_impl_frame_deadline_task_; | 186 base::CancelableClosure begin_impl_frame_deadline_task_; |
190 | 187 |
191 SchedulerStateMachine state_machine_; | 188 SchedulerStateMachine state_machine_; |
192 bool inside_process_scheduled_actions_; | 189 bool inside_process_scheduled_actions_; |
193 SchedulerStateMachine::Action inside_action_; | 190 SchedulerStateMachine::Action inside_action_; |
194 | 191 |
195 private: | 192 protected: |
196 void ScheduleBeginImplFrameDeadline(); | 193 void ScheduleBeginImplFrameDeadline(); |
197 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 194 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
198 void SetupNextBeginFrameIfNeeded(); | 195 void SetupNextBeginFrameIfNeeded(); |
199 void PostBeginRetroFrameIfNeeded(); | 196 void PostBeginRetroFrameIfNeeded(); |
200 void DrawAndSwapIfPossible(); | 197 void DrawAndSwapIfPossible(); |
201 void DrawAndSwapForced(); | 198 void DrawAndSwapForced(); |
202 void ProcessScheduledActions(); | 199 void ProcessScheduledActions(); |
203 void UpdateCompositorTimingHistoryRecordingEnabled(); | 200 void UpdateCompositorTimingHistoryRecordingEnabled(); |
204 bool CanCommitAndActivateBeforeDeadline() const; | 201 bool ShouldRecoverMainLatency(const BeginFrameArgs& args) const; |
202 bool ShouldRecoverImplLatency(const BeginFrameArgs& args) const; | |
203 bool CanCommitAndActivateBeforeDeadline(const BeginFrameArgs& args) const; | |
205 void AdvanceCommitStateIfPossible(); | 204 void AdvanceCommitStateIfPossible(); |
206 bool IsBeginMainFrameSentOrStarted() const; | 205 bool IsBeginMainFrameSentOrStarted() const; |
207 void BeginRetroFrame(); | 206 void BeginRetroFrame(); |
208 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 207 // virtual for testing. |
208 virtual void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | |
sunnyps
2015/07/09 23:44:30
Left a comment below about how this isn't necessar
brianderson
2015/07/10 00:34:07
Done.
| |
209 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 209 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
210 void BeginImplFrame(const BeginFrameArgs& args); | 210 void BeginImplFrame(const BeginFrameArgs& args); |
211 void FinishImplFrame(); | 211 void FinishImplFrame(); |
212 void OnBeginImplFrameDeadline(); | 212 void OnBeginImplFrameDeadline(); |
213 void PollToAdvanceCommitState(); | 213 void PollToAdvanceCommitState(); |
214 | 214 |
215 base::TimeDelta EstimatedParentDrawTime() { | 215 base::TimeDelta EstimatedParentDrawTime() { |
216 return estimated_parent_draw_time_; | 216 return estimated_parent_draw_time_; |
217 } | 217 } |
218 | 218 |
219 bool IsInsideAction(SchedulerStateMachine::Action action) { | 219 bool IsInsideAction(SchedulerStateMachine::Action action) { |
220 return inside_action_ == action; | 220 return inside_action_ == action; |
221 } | 221 } |
222 | 222 |
223 BeginFrameSource* primary_frame_source() { | 223 BeginFrameSource* primary_frame_source() { |
224 if (settings_.use_external_begin_frame_source) { | 224 if (settings_.use_external_begin_frame_source) { |
225 DCHECK(external_frame_source_); | 225 DCHECK(external_frame_source_); |
226 return external_frame_source_; | 226 return external_frame_source_; |
227 } | 227 } |
228 return synthetic_frame_source_.get(); | 228 return synthetic_frame_source_.get(); |
229 } | 229 } |
230 | 230 |
231 base::WeakPtrFactory<Scheduler> weak_factory_; | 231 base::WeakPtrFactory<Scheduler> weak_factory_; |
sunnyps
2015/07/09 23:44:30
weak_factory_ should always be private.
brianderson
2015/07/10 00:34:08
Done.
| |
232 | 232 |
233 private: | |
233 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 234 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
234 }; | 235 }; |
235 | 236 |
236 } // namespace cc | 237 } // namespace cc |
237 | 238 |
238 #endif // CC_SCHEDULER_SCHEDULER_H_ | 239 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |