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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 DCHECK_GE(draw_time.ToInternalValue(), 0); | 128 DCHECK_GE(draw_time.ToInternalValue(), 0); |
129 estimated_parent_draw_time_ = draw_time; | 129 estimated_parent_draw_time_ = draw_time; |
130 } | 130 } |
131 | 131 |
132 void Scheduler::SetVisible(bool visible) { | 132 void Scheduler::SetVisible(bool visible) { |
133 state_machine_.SetVisible(visible); | 133 state_machine_.SetVisible(visible); |
134 UpdateCompositorTimingHistoryRecordingEnabled(); | 134 UpdateCompositorTimingHistoryRecordingEnabled(); |
135 ProcessScheduledActions(); | 135 ProcessScheduledActions(); |
136 } | 136 } |
137 | 137 |
138 void Scheduler::SetResourcelessSoftareDraw(bool resourceless_draw) { | |
139 state_machine_.SetResourcelessSoftareDraw(resourceless_draw); | |
140 ProcessScheduledActions(); | |
141 } | |
142 | |
143 void Scheduler::SetCanDraw(bool can_draw) { | 138 void Scheduler::SetCanDraw(bool can_draw) { |
144 state_machine_.SetCanDraw(can_draw); | 139 state_machine_.SetCanDraw(can_draw); |
145 ProcessScheduledActions(); | 140 ProcessScheduledActions(); |
146 } | 141 } |
147 | 142 |
148 void Scheduler::NotifyReadyToActivate() { | 143 void Scheduler::NotifyReadyToActivate() { |
149 compositor_timing_history_->ReadyToActivate(); | 144 compositor_timing_history_->ReadyToActivate(); |
150 state_machine_.NotifyReadyToActivate(); | 145 state_machine_.NotifyReadyToActivate(); |
151 ProcessScheduledActions(); | 146 ProcessScheduledActions(); |
152 } | 147 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 synthetic_frame_source_->OnUpdateVSyncParameters(last_vsync_timebase_, | 362 synthetic_frame_source_->OnUpdateVSyncParameters(last_vsync_timebase_, |
368 interval); | 363 interval); |
369 } | 364 } |
370 } | 365 } |
371 | 366 |
372 void Scheduler::SetVideoNeedsBeginFrames(bool video_needs_begin_frames) { | 367 void Scheduler::SetVideoNeedsBeginFrames(bool video_needs_begin_frames) { |
373 state_machine_.SetVideoNeedsBeginFrames(video_needs_begin_frames); | 368 state_machine_.SetVideoNeedsBeginFrames(video_needs_begin_frames); |
374 ProcessScheduledActions(); | 369 ProcessScheduledActions(); |
375 } | 370 } |
376 | 371 |
377 void Scheduler::OnDrawForOutputSurface() { | 372 void Scheduler::OnDrawForOutputSurface(bool resourceless_software_draw) { |
378 DCHECK(settings_.using_synchronous_renderer_compositor); | 373 DCHECK(settings_.using_synchronous_renderer_compositor); |
379 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | 374 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
380 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 375 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
381 DCHECK(!BeginImplFrameDeadlinePending()); | 376 DCHECK(!BeginImplFrameDeadlinePending()); |
382 | 377 |
| 378 state_machine_.SetResourcelessSoftareDraw(resourceless_software_draw); |
383 state_machine_.OnBeginImplFrameDeadline(); | 379 state_machine_.OnBeginImplFrameDeadline(); |
384 ProcessScheduledActions(); | 380 ProcessScheduledActions(); |
385 | 381 |
386 state_machine_.OnBeginImplFrameIdle(); | 382 state_machine_.OnBeginImplFrameIdle(); |
387 ProcessScheduledActions(); | 383 ProcessScheduledActions(); |
| 384 state_machine_.SetResourcelessSoftareDraw(false); |
388 } | 385 } |
389 | 386 |
390 // BeginRetroFrame is called for BeginFrames that we've deferred because | 387 // BeginRetroFrame is called for BeginFrames that we've deferred because |
391 // the scheduler was in the middle of processing a previous BeginFrame. | 388 // the scheduler was in the middle of processing a previous BeginFrame. |
392 void Scheduler::BeginRetroFrame() { | 389 void Scheduler::BeginRetroFrame() { |
393 TRACE_EVENT0("cc,benchmark", "Scheduler::BeginRetroFrame"); | 390 TRACE_EVENT0("cc,benchmark", "Scheduler::BeginRetroFrame"); |
394 DCHECK(!settings_.using_synchronous_renderer_compositor); | 391 DCHECK(!settings_.using_synchronous_renderer_compositor); |
395 DCHECK(!begin_retro_frame_args_.empty()); | 392 DCHECK(!begin_retro_frame_args_.empty()); |
396 DCHECK(!begin_retro_frame_task_.IsCancelled()); | 393 DCHECK(!begin_retro_frame_task_.IsCancelled()); |
397 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | 394 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 } | 893 } |
897 | 894 |
898 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 895 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
899 return (state_machine_.begin_main_frame_state() == | 896 return (state_machine_.begin_main_frame_state() == |
900 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || | 897 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || |
901 state_machine_.begin_main_frame_state() == | 898 state_machine_.begin_main_frame_state() == |
902 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); | 899 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); |
903 } | 900 } |
904 | 901 |
905 } // namespace cc | 902 } // namespace cc |
OLD | NEW |