| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // to signal that the start time isn't known and should not be used for | 139 // to signal that the start time isn't known and should not be used for |
| 140 // scheduling or statistics purposes. | 140 // scheduling or statistics purposes. |
| 141 void NotifyBeginMainFrameStarted(base::TimeTicks main_thread_start_time); | 141 void NotifyBeginMainFrameStarted(base::TimeTicks main_thread_start_time); |
| 142 | 142 |
| 143 base::TimeTicks LastBeginImplFrameTime(); | 143 base::TimeTicks LastBeginImplFrameTime(); |
| 144 | 144 |
| 145 void SetDeferCommits(bool defer_commits); | 145 void SetDeferCommits(bool defer_commits); |
| 146 | 146 |
| 147 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 147 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
| 148 | 148 |
| 149 void AsValueInto(base::trace_event::TracedValue* state) const; |
| 150 |
| 149 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); | 151 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); |
| 150 | 152 |
| 151 const BeginFrameSource* begin_frame_source() const { | 153 const BeginFrameSource* begin_frame_source() const { |
| 152 return begin_frame_source_; | 154 return begin_frame_source_; |
| 153 } | 155 } |
| 154 | 156 |
| 155 BeginFrameAck CurrentBeginFrameAckForActiveTree() const; | 157 BeginFrameAck CurrentBeginFrameAckForActiveTree() const; |
| 156 | 158 |
| 157 protected: | 159 protected: |
| 158 // Virtual for testing. | 160 // Virtual for testing. |
| 159 virtual base::TimeTicks Now() const; | 161 virtual base::TimeTicks Now() const; |
| 160 | 162 |
| 161 const SchedulerSettings settings_; | 163 const SchedulerSettings settings_; |
| 162 // Not owned. | 164 SchedulerClient* const client_; |
| 163 SchedulerClient* client_; | 165 const int layer_tree_host_id_; |
| 164 int layer_tree_host_id_; | |
| 165 base::SingleThreadTaskRunner* task_runner_; | 166 base::SingleThreadTaskRunner* task_runner_; |
| 166 | 167 |
| 167 // Not owned. May be null. | 168 BeginFrameSource* begin_frame_source_ = nullptr; |
| 168 BeginFrameSource* begin_frame_source_; | 169 bool observing_begin_frame_source_ = false; |
| 169 bool observing_begin_frame_source_; | 170 |
| 171 bool skipped_last_frame_missed_exceeded_deadline_ = false; |
| 172 bool skipped_last_frame_to_reduce_latency_ = false; |
| 170 | 173 |
| 171 std::unique_ptr<CompositorTimingHistory> compositor_timing_history_; | 174 std::unique_ptr<CompositorTimingHistory> compositor_timing_history_; |
| 172 | 175 |
| 173 SchedulerStateMachine::BeginImplFrameDeadlineMode | 176 SchedulerStateMachine::BeginImplFrameDeadlineMode |
| 174 begin_impl_frame_deadline_mode_; | 177 begin_impl_frame_deadline_mode_ = |
| 178 SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE; |
| 179 |
| 175 BeginFrameTracker begin_impl_frame_tracker_; | 180 BeginFrameTracker begin_impl_frame_tracker_; |
| 176 BeginFrameArgs begin_main_frame_args_; | 181 BeginFrameArgs begin_main_frame_args_; |
| 177 | 182 |
| 178 base::Closure begin_impl_frame_deadline_closure_; | 183 base::Closure begin_impl_frame_deadline_closure_; |
| 179 base::CancelableClosure begin_impl_frame_deadline_task_; | 184 base::CancelableClosure begin_impl_frame_deadline_task_; |
| 180 base::CancelableClosure missed_begin_frame_task_; | 185 base::CancelableClosure missed_begin_frame_task_; |
| 181 | 186 |
| 182 SchedulerStateMachine state_machine_; | 187 SchedulerStateMachine state_machine_; |
| 183 bool inside_process_scheduled_actions_; | 188 bool inside_process_scheduled_actions_ = false; |
| 184 SchedulerStateMachine::Action inside_action_; | 189 SchedulerStateMachine::Action inside_action_ = |
| 190 SchedulerStateMachine::ACTION_NONE; |
| 185 | 191 |
| 186 bool stopped_; | 192 bool stopped_ = false; |
| 187 | 193 |
| 188 private: | 194 private: |
| 189 void ScheduleBeginImplFrameDeadline(); | 195 void ScheduleBeginImplFrameDeadline(); |
| 190 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 196 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
| 191 void BeginImplFrameNotExpectedSoon(); | 197 void BeginImplFrameNotExpectedSoon(); |
| 192 void SetupNextBeginFrameIfNeeded(); | 198 void SetupNextBeginFrameIfNeeded(); |
| 193 void DrawIfPossible(); | 199 void DrawIfPossible(); |
| 194 void DrawForced(); | 200 void DrawForced(); |
| 195 void ProcessScheduledActions(); | 201 void ProcessScheduledActions(); |
| 196 void UpdateCompositorTimingHistoryRecordingEnabled(); | 202 void UpdateCompositorTimingHistoryRecordingEnabled(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 218 } | 224 } |
| 219 | 225 |
| 220 base::WeakPtrFactory<Scheduler> weak_factory_; | 226 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 221 | 227 |
| 222 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 228 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 223 }; | 229 }; |
| 224 | 230 |
| 225 } // namespace cc | 231 } // namespace cc |
| 226 | 232 |
| 227 #endif // CC_SCHEDULER_SCHEDULER_H_ | 233 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |