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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 synthetic_frame_source_->OnUpdateVSyncParameters(last_vsync_timebase_, | 350 synthetic_frame_source_->OnUpdateVSyncParameters(last_vsync_timebase_, |
356 interval); | 351 interval); |
357 } | 352 } |
358 } | 353 } |
359 | 354 |
360 void Scheduler::SetVideoNeedsBeginFrames(bool video_needs_begin_frames) { | 355 void Scheduler::SetVideoNeedsBeginFrames(bool video_needs_begin_frames) { |
361 state_machine_.SetVideoNeedsBeginFrames(video_needs_begin_frames); | 356 state_machine_.SetVideoNeedsBeginFrames(video_needs_begin_frames); |
362 ProcessScheduledActions(); | 357 ProcessScheduledActions(); |
363 } | 358 } |
364 | 359 |
365 void Scheduler::OnDrawForOutputSurface() { | 360 void Scheduler::OnDrawForOutputSurface(bool resourceless_software_draw) { |
366 DCHECK(settings_.using_synchronous_renderer_compositor); | 361 DCHECK(settings_.using_synchronous_renderer_compositor); |
367 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | 362 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
368 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 363 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
369 DCHECK(!BeginImplFrameDeadlinePending()); | 364 DCHECK(!BeginImplFrameDeadlinePending()); |
370 | 365 |
| 366 state_machine_.SetResourcelessSoftareDraw(resourceless_software_draw); |
371 state_machine_.OnBeginImplFrameDeadline(); | 367 state_machine_.OnBeginImplFrameDeadline(); |
372 ProcessScheduledActions(); | 368 ProcessScheduledActions(); |
373 | 369 |
374 state_machine_.OnBeginImplFrameIdle(); | 370 state_machine_.OnBeginImplFrameIdle(); |
375 ProcessScheduledActions(); | 371 ProcessScheduledActions(); |
| 372 state_machine_.SetResourcelessSoftareDraw(false); |
376 } | 373 } |
377 | 374 |
378 // BeginRetroFrame is called for BeginFrames that we've deferred because | 375 // BeginRetroFrame is called for BeginFrames that we've deferred because |
379 // the scheduler was in the middle of processing a previous BeginFrame. | 376 // the scheduler was in the middle of processing a previous BeginFrame. |
380 void Scheduler::BeginRetroFrame() { | 377 void Scheduler::BeginRetroFrame() { |
381 TRACE_EVENT0("cc,benchmark", "Scheduler::BeginRetroFrame"); | 378 TRACE_EVENT0("cc,benchmark", "Scheduler::BeginRetroFrame"); |
382 DCHECK(!settings_.using_synchronous_renderer_compositor); | 379 DCHECK(!settings_.using_synchronous_renderer_compositor); |
383 DCHECK(!begin_retro_frame_args_.empty()); | 380 DCHECK(!begin_retro_frame_args_.empty()); |
384 DCHECK(!begin_retro_frame_task_.IsCancelled()); | 381 DCHECK(!begin_retro_frame_task_.IsCancelled()); |
385 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | 382 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 } | 834 } |
838 | 835 |
839 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 836 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
840 return (state_machine_.begin_main_frame_state() == | 837 return (state_machine_.begin_main_frame_state() == |
841 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || | 838 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || |
842 state_machine_.begin_main_frame_state() == | 839 state_machine_.begin_main_frame_state() == |
843 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); | 840 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); |
844 } | 841 } |
845 | 842 |
846 } // namespace cc | 843 } // namespace cc |
OLD | NEW |