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 #include "cc/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_PREPARE_TILES)); | 191 DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_PREPARE_TILES)); |
192 state_machine_.SetNeedsPrepareTiles(); | 192 state_machine_.SetNeedsPrepareTiles(); |
193 ProcessScheduledActions(); | 193 ProcessScheduledActions(); |
194 } | 194 } |
195 | 195 |
196 void Scheduler::SetMaxSwapsPending(int max) { | 196 void Scheduler::SetMaxSwapsPending(int max) { |
197 state_machine_.SetMaxSwapsPending(max); | 197 state_machine_.SetMaxSwapsPending(max); |
198 } | 198 } |
199 | 199 |
200 void Scheduler::DidSwapBuffers() { | 200 void Scheduler::DidSwapBuffers() { |
| 201 compositor_timing_history_->DidSwapBuffers(); |
201 state_machine_.DidSwapBuffers(); | 202 state_machine_.DidSwapBuffers(); |
202 | 203 |
203 // There is no need to call ProcessScheduledActions here because | 204 // There is no need to call ProcessScheduledActions here because |
204 // swapping should not trigger any new actions. | 205 // swapping should not trigger any new actions. |
205 if (!inside_process_scheduled_actions_) { | 206 if (!inside_process_scheduled_actions_) { |
206 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); | 207 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); |
207 } | 208 } |
208 } | 209 } |
209 | 210 |
210 void Scheduler::DidSwapBuffersComplete() { | 211 void Scheduler::DidSwapBuffersComplete() { |
211 DCHECK_GT(state_machine_.pending_swaps(), 0) << AsValue()->ToString(); | 212 DCHECK_GT(state_machine_.pending_swaps(), 0) << AsValue()->ToString(); |
| 213 compositor_timing_history_->DidSwapBuffersComplete(); |
212 state_machine_.DidSwapBuffersComplete(); | 214 state_machine_.DidSwapBuffersComplete(); |
213 ProcessScheduledActions(); | 215 ProcessScheduledActions(); |
214 } | 216 } |
215 | 217 |
216 void Scheduler::SetSmoothnessMode(bool smoothness_takes_priority, | 218 void Scheduler::SetSmoothnessMode(bool smoothness_takes_priority, |
217 bool scroll_affects_scroll_handler) { | 219 bool scroll_affects_scroll_handler) { |
218 state_machine_.SetSmoothnessMode(smoothness_takes_priority, | 220 state_machine_.SetSmoothnessMode(smoothness_takes_priority, |
219 scroll_affects_scroll_handler); | 221 scroll_affects_scroll_handler); |
220 ProcessScheduledActions(); | 222 ProcessScheduledActions(); |
221 } | 223 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 begin_retro_frame_task_.Cancel(); | 255 begin_retro_frame_task_.Cancel(); |
254 state_machine_.DidLoseOutputSurface(); | 256 state_machine_.DidLoseOutputSurface(); |
255 UpdateCompositorTimingHistoryRecordingEnabled(); | 257 UpdateCompositorTimingHistoryRecordingEnabled(); |
256 ProcessScheduledActions(); | 258 ProcessScheduledActions(); |
257 } | 259 } |
258 | 260 |
259 void Scheduler::DidCreateAndInitializeOutputSurface() { | 261 void Scheduler::DidCreateAndInitializeOutputSurface() { |
260 TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeOutputSurface"); | 262 TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeOutputSurface"); |
261 DCHECK(!frame_source_->NeedsBeginFrames()); | 263 DCHECK(!frame_source_->NeedsBeginFrames()); |
262 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); | 264 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); |
| 265 compositor_timing_history_->DidSwapBuffersReset(); |
263 state_machine_.DidCreateAndInitializeOutputSurface(); | 266 state_machine_.DidCreateAndInitializeOutputSurface(); |
264 UpdateCompositorTimingHistoryRecordingEnabled(); | 267 UpdateCompositorTimingHistoryRecordingEnabled(); |
265 ProcessScheduledActions(); | 268 ProcessScheduledActions(); |
266 } | 269 } |
267 | 270 |
268 void Scheduler::NotifyBeginMainFrameStarted( | 271 void Scheduler::NotifyBeginMainFrameStarted( |
269 base::TimeTicks main_thread_start_time) { | 272 base::TimeTicks main_thread_start_time) { |
270 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); | 273 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); |
271 state_machine_.NotifyBeginMainFrameStarted(); | 274 state_machine_.NotifyBeginMainFrameStarted(); |
272 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time); | 275 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time); |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 } | 886 } |
884 | 887 |
885 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 888 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
886 return (state_machine_.begin_main_frame_state() == | 889 return (state_machine_.begin_main_frame_state() == |
887 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || | 890 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || |
888 state_machine_.begin_main_frame_state() == | 891 state_machine_.begin_main_frame_state() == |
889 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); | 892 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); |
890 } | 893 } |
891 | 894 |
892 } // namespace cc | 895 } // namespace cc |
OLD | NEW |