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