| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 194 } |
| 195 | 195 |
| 196 void Scheduler::SetMaxSwapsPending(int max) { | 196 void Scheduler::SetMaxSwapsPending(int max) { |
| 197 // TODO(brianderson): Remove all callers of this function. | 197 // TODO(brianderson): Remove all callers of this function. |
| 198 DCHECK_EQ(1, max) << "Surface and CompositorTimingHistory do not support " | 198 DCHECK_EQ(1, max) << "Surface and CompositorTimingHistory do not support " |
| 199 "multiple pending swaps."; | 199 "multiple pending swaps."; |
| 200 state_machine_.SetMaxSwapsPending(max); | 200 state_machine_.SetMaxSwapsPending(max); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void Scheduler::DidSwapBuffers() { | 203 void Scheduler::DidSwapBuffers() { |
| 204 compositor_timing_history_->DidSwapBuffers(); |
| 204 state_machine_.DidSwapBuffers(); | 205 state_machine_.DidSwapBuffers(); |
| 205 | 206 |
| 206 // There is no need to call ProcessScheduledActions here because | 207 // There is no need to call ProcessScheduledActions here because |
| 207 // swapping should not trigger any new actions. | 208 // swapping should not trigger any new actions. |
| 208 if (!inside_process_scheduled_actions_) { | 209 if (!inside_process_scheduled_actions_) { |
| 209 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); | 210 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); |
| 210 } | 211 } |
| 211 } | 212 } |
| 212 | 213 |
| 213 void Scheduler::DidSwapBuffersComplete() { | 214 void Scheduler::DidSwapBuffersComplete() { |
| 214 DCHECK_GT(state_machine_.pending_swaps(), 0) << AsValue()->ToString(); | 215 DCHECK_GT(state_machine_.pending_swaps(), 0) << AsValue()->ToString(); |
| 216 compositor_timing_history_->DidSwapBuffersComplete(); |
| 215 state_machine_.DidSwapBuffersComplete(); | 217 state_machine_.DidSwapBuffersComplete(); |
| 216 ProcessScheduledActions(); | 218 ProcessScheduledActions(); |
| 217 } | 219 } |
| 218 | 220 |
| 219 void Scheduler::SetImplLatencyTakesPriority(bool impl_latency_takes_priority) { | 221 void Scheduler::SetImplLatencyTakesPriority(bool impl_latency_takes_priority) { |
| 220 state_machine_.SetImplLatencyTakesPriority(impl_latency_takes_priority); | 222 state_machine_.SetImplLatencyTakesPriority(impl_latency_takes_priority); |
| 221 ProcessScheduledActions(); | 223 ProcessScheduledActions(); |
| 222 } | 224 } |
| 223 | 225 |
| 224 void Scheduler::NotifyReadyToCommit() { | 226 void Scheduler::NotifyReadyToCommit() { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 254 begin_retro_frame_task_.Cancel(); | 256 begin_retro_frame_task_.Cancel(); |
| 255 state_machine_.DidLoseOutputSurface(); | 257 state_machine_.DidLoseOutputSurface(); |
| 256 UpdateCompositorTimingHistoryRecordingEnabled(); | 258 UpdateCompositorTimingHistoryRecordingEnabled(); |
| 257 ProcessScheduledActions(); | 259 ProcessScheduledActions(); |
| 258 } | 260 } |
| 259 | 261 |
| 260 void Scheduler::DidCreateAndInitializeOutputSurface() { | 262 void Scheduler::DidCreateAndInitializeOutputSurface() { |
| 261 TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeOutputSurface"); | 263 TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeOutputSurface"); |
| 262 DCHECK(!frame_source_->NeedsBeginFrames()); | 264 DCHECK(!frame_source_->NeedsBeginFrames()); |
| 263 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); | 265 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); |
| 266 compositor_timing_history_->DidSwapBuffersReset(); |
| 264 state_machine_.DidCreateAndInitializeOutputSurface(); | 267 state_machine_.DidCreateAndInitializeOutputSurface(); |
| 265 UpdateCompositorTimingHistoryRecordingEnabled(); | 268 UpdateCompositorTimingHistoryRecordingEnabled(); |
| 266 ProcessScheduledActions(); | 269 ProcessScheduledActions(); |
| 267 } | 270 } |
| 268 | 271 |
| 269 void Scheduler::NotifyBeginMainFrameStarted( | 272 void Scheduler::NotifyBeginMainFrameStarted( |
| 270 base::TimeTicks main_thread_start_time) { | 273 base::TimeTicks main_thread_start_time) { |
| 271 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); | 274 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); |
| 272 state_machine_.NotifyBeginMainFrameStarted(); | 275 state_machine_.NotifyBeginMainFrameStarted(); |
| 273 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time); | 276 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time); |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 } | 853 } |
| 851 | 854 |
| 852 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 855 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 853 return (state_machine_.begin_main_frame_state() == | 856 return (state_machine_.begin_main_frame_state() == |
| 854 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || | 857 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || |
| 855 state_machine_.begin_main_frame_state() == | 858 state_machine_.begin_main_frame_state() == |
| 856 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); | 859 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); |
| 857 } | 860 } |
| 858 | 861 |
| 859 } // namespace cc | 862 } // namespace cc |
| OLD | NEW |