| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 int layer_tree_host_id_; | 156 int layer_tree_host_id_; |
| 157 base::SingleThreadTaskRunner* task_runner_; | 157 base::SingleThreadTaskRunner* task_runner_; |
| 158 | 158 |
| 159 // Not owned. May be null. | 159 // Not owned. May be null. |
| 160 BeginFrameSource* begin_frame_source_; | 160 BeginFrameSource* begin_frame_source_; |
| 161 bool observing_begin_frame_source_; | 161 bool observing_begin_frame_source_; |
| 162 | 162 |
| 163 std::unique_ptr<CompositorTimingHistory> compositor_timing_history_; | 163 std::unique_ptr<CompositorTimingHistory> compositor_timing_history_; |
| 164 base::TimeDelta estimated_parent_draw_time_; | 164 base::TimeDelta estimated_parent_draw_time_; |
| 165 | 165 |
| 166 std::deque<BeginFrameArgs> begin_retro_frame_args_; | |
| 167 SchedulerStateMachine::BeginImplFrameDeadlineMode | 166 SchedulerStateMachine::BeginImplFrameDeadlineMode |
| 168 begin_impl_frame_deadline_mode_; | 167 begin_impl_frame_deadline_mode_; |
| 169 BeginFrameTracker begin_impl_frame_tracker_; | 168 BeginFrameTracker begin_impl_frame_tracker_; |
| 170 BeginFrameArgs begin_main_frame_args_; | 169 BeginFrameArgs begin_main_frame_args_; |
| 171 | 170 |
| 172 base::Closure begin_retro_frame_closure_; | 171 base::CancelableClosure missed_begin_frame_task_; |
| 172 |
| 173 base::Closure begin_impl_frame_deadline_closure_; | 173 base::Closure begin_impl_frame_deadline_closure_; |
| 174 base::CancelableClosure begin_retro_frame_task_; | |
| 175 base::CancelableClosure begin_impl_frame_deadline_task_; | 174 base::CancelableClosure begin_impl_frame_deadline_task_; |
| 176 | 175 |
| 177 SchedulerStateMachine state_machine_; | 176 SchedulerStateMachine state_machine_; |
| 178 bool inside_process_scheduled_actions_; | 177 bool inside_process_scheduled_actions_; |
| 179 SchedulerStateMachine::Action inside_action_; | 178 SchedulerStateMachine::Action inside_action_; |
| 180 | 179 |
| 181 private: | 180 private: |
| 182 void ScheduleBeginImplFrameDeadline(); | 181 void ScheduleBeginImplFrameDeadline(); |
| 183 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 182 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
| 184 void BeginImplFrameNotExpectedSoon(); | 183 void BeginImplFrameNotExpectedSoon(); |
| 185 void SetupNextBeginFrameIfNeeded(); | 184 void SetupNextBeginFrameIfNeeded(); |
| 186 void PostBeginRetroFrameIfNeeded(); | |
| 187 void DrawAndSwapIfPossible(); | 185 void DrawAndSwapIfPossible(); |
| 188 void DrawAndSwapForced(); | 186 void DrawAndSwapForced(); |
| 189 void ProcessScheduledActions(); | 187 void ProcessScheduledActions(); |
| 190 void UpdateCompositorTimingHistoryRecordingEnabled(); | 188 void UpdateCompositorTimingHistoryRecordingEnabled(); |
| 191 bool ShouldRecoverMainLatency(const BeginFrameArgs& args, | 189 bool ShouldRecoverMainLatency(const BeginFrameArgs& args, |
| 192 bool can_activate_before_deadline) const; | 190 bool can_activate_before_deadline) const; |
| 193 bool ShouldRecoverImplLatency(const BeginFrameArgs& args, | 191 bool ShouldRecoverImplLatency(const BeginFrameArgs& args, |
| 194 bool can_activate_before_deadline) const; | 192 bool can_activate_before_deadline) const; |
| 195 bool CanBeginMainFrameAndActivateBeforeDeadline( | 193 bool CanBeginMainFrameAndActivateBeforeDeadline( |
| 196 const BeginFrameArgs& args, | 194 const BeginFrameArgs& args, |
| 197 base::TimeDelta bmf_to_activate_estimate) const; | 195 base::TimeDelta bmf_to_activate_estimate) const; |
| 198 void AdvanceCommitStateIfPossible(); | 196 void AdvanceCommitStateIfPossible(); |
| 199 bool IsBeginMainFrameSentOrStarted() const; | 197 bool IsBeginMainFrameSentOrStarted() const; |
| 200 void BeginRetroFrame(); | |
| 201 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 198 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
| 202 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 199 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
| 203 void BeginImplFrame(const BeginFrameArgs& args); | 200 void BeginImplFrame(const BeginFrameArgs& args); |
| 204 void FinishImplFrame(); | 201 void FinishImplFrame(); |
| 205 void OnBeginImplFrameDeadline(); | 202 void OnBeginImplFrameDeadline(); |
| 206 void PollToAdvanceCommitState(); | 203 void PollToAdvanceCommitState(); |
| 207 | 204 |
| 208 base::TimeDelta EstimatedParentDrawTime() { | 205 base::TimeDelta EstimatedParentDrawTime() { |
| 209 return estimated_parent_draw_time_; | 206 return estimated_parent_draw_time_; |
| 210 } | 207 } |
| 211 | 208 |
| 212 bool IsInsideAction(SchedulerStateMachine::Action action) { | 209 bool IsInsideAction(SchedulerStateMachine::Action action) { |
| 213 return inside_action_ == action; | 210 return inside_action_ == action; |
| 214 } | 211 } |
| 215 | 212 |
| 216 base::WeakPtrFactory<Scheduler> weak_factory_; | 213 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 217 | 214 |
| 218 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 215 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 219 }; | 216 }; |
| 220 | 217 |
| 221 } // namespace cc | 218 } // namespace cc |
| 222 | 219 |
| 223 #endif // CC_SCHEDULER_SCHEDULER_H_ | 220 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |