| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 state_machine_.DidSwapBuffers(); | 219 state_machine_.DidSwapBuffers(); |
| 220 | 220 |
| 221 // There is no need to call ProcessScheduledActions here because | 221 // There is no need to call ProcessScheduledActions here because |
| 222 // swapping should not trigger any new actions. | 222 // swapping should not trigger any new actions. |
| 223 if (!inside_process_scheduled_actions_) { | 223 if (!inside_process_scheduled_actions_) { |
| 224 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); | 224 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 | 227 |
| 228 void Scheduler::DidSwapBuffersComplete() { | 228 void Scheduler::DidSwapBuffersComplete() { |
| 229 DCHECK_GT(state_machine_.pending_swaps(), 0) << AsValue()->ToString(); |
| 229 state_machine_.DidSwapBuffersComplete(); | 230 state_machine_.DidSwapBuffersComplete(); |
| 230 ProcessScheduledActions(); | 231 ProcessScheduledActions(); |
| 231 } | 232 } |
| 232 | 233 |
| 233 void Scheduler::SetImplLatencyTakesPriority(bool impl_latency_takes_priority) { | 234 void Scheduler::SetImplLatencyTakesPriority(bool impl_latency_takes_priority) { |
| 234 state_machine_.SetImplLatencyTakesPriority(impl_latency_takes_priority); | 235 state_machine_.SetImplLatencyTakesPriority(impl_latency_takes_priority); |
| 235 ProcessScheduledActions(); | 236 ProcessScheduledActions(); |
| 236 } | 237 } |
| 237 | 238 |
| 238 void Scheduler::NotifyReadyToCommit() { | 239 void Scheduler::NotifyReadyToCommit() { |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 state->EndDictionary(); | 766 state->EndDictionary(); |
| 766 } | 767 } |
| 767 | 768 |
| 768 state->BeginDictionary("scheduler_state"); | 769 state->BeginDictionary("scheduler_state"); |
| 769 state->SetDouble("time_until_anticipated_draw_time_ms", | 770 state->SetDouble("time_until_anticipated_draw_time_ms", |
| 770 (AnticipatedDrawTime() - Now()).InMillisecondsF()); | 771 (AnticipatedDrawTime() - Now()).InMillisecondsF()); |
| 771 state->SetDouble("estimated_parent_draw_time_ms", | 772 state->SetDouble("estimated_parent_draw_time_ms", |
| 772 estimated_parent_draw_time_.InMillisecondsF()); | 773 estimated_parent_draw_time_.InMillisecondsF()); |
| 773 state->SetBoolean("last_set_needs_begin_frame_", | 774 state->SetBoolean("last_set_needs_begin_frame_", |
| 774 frame_source_->NeedsBeginFrames()); | 775 frame_source_->NeedsBeginFrames()); |
| 775 state->SetInteger("begin_retro_frame_args_", | 776 state->SetInteger("begin_retro_frame_args", |
| 776 static_cast<int>(begin_retro_frame_args_.size())); | 777 static_cast<int>(begin_retro_frame_args_.size())); |
| 777 state->SetBoolean("begin_retro_frame_task_", | 778 state->SetBoolean("begin_retro_frame_task", |
| 778 !begin_retro_frame_task_.IsCancelled()); | 779 !begin_retro_frame_task_.IsCancelled()); |
| 779 state->SetBoolean("begin_impl_frame_deadline_task_", | 780 state->SetBoolean("begin_impl_frame_deadline_task", |
| 780 !begin_impl_frame_deadline_task_.IsCancelled()); | 781 !begin_impl_frame_deadline_task_.IsCancelled()); |
| 781 state->SetBoolean("advance_commit_state_task_", | 782 state->SetBoolean("advance_commit_state_task", |
| 782 !advance_commit_state_task_.IsCancelled()); | 783 !advance_commit_state_task_.IsCancelled()); |
| 784 state->SetString("inside_action", |
| 785 SchedulerStateMachine::ActionToString(inside_action_)); |
| 783 state->BeginDictionary("begin_impl_frame_args"); | 786 state->BeginDictionary("begin_impl_frame_args"); |
| 784 begin_impl_frame_tracker_.AsValueInto(Now(), state); | 787 begin_impl_frame_tracker_.AsValueInto(Now(), state); |
| 785 state->EndDictionary(); | 788 state->EndDictionary(); |
| 786 state->EndDictionary(); | 789 state->EndDictionary(); |
| 787 | 790 |
| 788 state->BeginDictionary("client_state"); | 791 state->BeginDictionary("client_state"); |
| 789 state->SetDouble("draw_duration_estimate_ms", | 792 state->SetDouble("draw_duration_estimate_ms", |
| 790 client_->DrawDurationEstimate().InMillisecondsF()); | 793 client_->DrawDurationEstimate().InMillisecondsF()); |
| 791 state->SetDouble( | 794 state->SetDouble( |
| 792 "begin_main_frame_to_commit_duration_estimate_ms", | 795 "begin_main_frame_to_commit_duration_estimate_ms", |
| (...skipping 24 matching lines...) Expand all Loading... |
| 817 } | 820 } |
| 818 | 821 |
| 819 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 822 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 820 return (state_machine_.commit_state() == | 823 return (state_machine_.commit_state() == |
| 821 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 824 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
| 822 state_machine_.commit_state() == | 825 state_machine_.commit_state() == |
| 823 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 826 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
| 824 } | 827 } |
| 825 | 828 |
| 826 } // namespace cc | 829 } // namespace cc |
| OLD | NEW |