| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 530 |
| 531 begin_impl_frame_args_ = args; | 531 begin_impl_frame_args_ = args; |
| 532 begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); | 532 begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); |
| 533 | 533 |
| 534 if (!state_machine_.impl_latency_takes_priority() && | 534 if (!state_machine_.impl_latency_takes_priority() && |
| 535 main_thread_is_in_high_latency_mode && | 535 main_thread_is_in_high_latency_mode && |
| 536 CanCommitAndActivateBeforeDeadline()) { | 536 CanCommitAndActivateBeforeDeadline()) { |
| 537 state_machine_.SetSkipNextBeginMainFrameToReduceLatency(); | 537 state_machine_.SetSkipNextBeginMainFrameToReduceLatency(); |
| 538 } | 538 } |
| 539 | 539 |
| 540 state_machine_.OnBeginImplFrame(begin_impl_frame_args_); | 540 state_machine_.OnBeginImplFrame(); |
| 541 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); | 541 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); |
| 542 client_->WillBeginImplFrame(begin_impl_frame_args_); | 542 client_->WillBeginImplFrame(begin_impl_frame_args_); |
| 543 | 543 |
| 544 ProcessScheduledActions(); | 544 ProcessScheduledActions(); |
| 545 | 545 |
| 546 state_machine_.OnBeginImplFrameDeadlinePending(); | 546 state_machine_.OnBeginImplFrameDeadlinePending(); |
| 547 | 547 |
| 548 if (settings_.using_synchronous_renderer_compositor) { | 548 if (settings_.using_synchronous_renderer_compositor) { |
| 549 // The synchronous renderer compositor has to make its GL calls | 549 // The synchronous renderer compositor has to make its GL calls |
| 550 // within this call. | 550 // within this call. |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 scoped_refptr<base::trace_event::ConvertableToTraceFormat> Scheduler::AsValue() | 793 scoped_refptr<base::trace_event::ConvertableToTraceFormat> Scheduler::AsValue() |
| 794 const { | 794 const { |
| 795 scoped_refptr<base::trace_event::TracedValue> state = | 795 scoped_refptr<base::trace_event::TracedValue> state = |
| 796 new base::trace_event::TracedValue(); | 796 new base::trace_event::TracedValue(); |
| 797 AsValueInto(state.get()); | 797 AsValueInto(state.get()); |
| 798 return state; | 798 return state; |
| 799 } | 799 } |
| 800 | 800 |
| 801 void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const { | 801 void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const { |
| 802 state->BeginDictionary("state_machine"); | 802 state->BeginDictionary("state_machine"); |
| 803 state_machine_.AsValueInto(state, Now()); | 803 state_machine_.AsValueInto(state); |
| 804 state->EndDictionary(); | 804 state->EndDictionary(); |
| 805 | 805 |
| 806 // Only trace frame sources when explicitly enabled - http://crbug.com/420607 | 806 // Only trace frame sources when explicitly enabled - http://crbug.com/420607 |
| 807 bool frame_tracing_enabled = false; | 807 bool frame_tracing_enabled = false; |
| 808 TRACE_EVENT_CATEGORY_GROUP_ENABLED( | 808 TRACE_EVENT_CATEGORY_GROUP_ENABLED( |
| 809 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), | 809 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), |
| 810 &frame_tracing_enabled); | 810 &frame_tracing_enabled); |
| 811 if (frame_tracing_enabled) { | 811 if (frame_tracing_enabled) { |
| 812 state->BeginDictionary("frame_source_"); | 812 state->BeginDictionary("frame_source_"); |
| 813 frame_source_->AsValueInto(state); | 813 frame_source_->AsValueInto(state); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 827 state->SetBoolean("begin_impl_frame_deadline_task_", | 827 state->SetBoolean("begin_impl_frame_deadline_task_", |
| 828 !begin_impl_frame_deadline_task_.IsCancelled()); | 828 !begin_impl_frame_deadline_task_.IsCancelled()); |
| 829 state->SetBoolean("poll_for_draw_triggers_task_", | 829 state->SetBoolean("poll_for_draw_triggers_task_", |
| 830 !poll_for_draw_triggers_task_.IsCancelled()); | 830 !poll_for_draw_triggers_task_.IsCancelled()); |
| 831 state->SetBoolean("advance_commit_state_task_", | 831 state->SetBoolean("advance_commit_state_task_", |
| 832 !advance_commit_state_task_.IsCancelled()); | 832 !advance_commit_state_task_.IsCancelled()); |
| 833 state->BeginDictionary("begin_impl_frame_args"); | 833 state->BeginDictionary("begin_impl_frame_args"); |
| 834 begin_impl_frame_args_.AsValueInto(state); | 834 begin_impl_frame_args_.AsValueInto(state); |
| 835 state->EndDictionary(); | 835 state->EndDictionary(); |
| 836 | 836 |
| 837 base::TimeTicks now = Now(); |
| 838 base::TimeTicks frame_time = begin_impl_frame_args_.frame_time; |
| 839 base::TimeTicks deadline = begin_impl_frame_args_.deadline; |
| 840 base::TimeDelta interval = begin_impl_frame_args_.interval; |
| 841 state->BeginDictionary("major_timestamps_in_ms"); |
| 842 state->SetDouble("0_interval", interval.InMillisecondsF()); |
| 843 state->SetDouble("1_now_to_deadline", (deadline - now).InMillisecondsF()); |
| 844 state->SetDouble("2_frame_time_to_now", (now - frame_time).InMillisecondsF()); |
| 845 state->SetDouble("3_frame_time_to_deadline", |
| 846 (deadline - frame_time).InMillisecondsF()); |
| 847 state->SetDouble("4_now", (now - base::TimeTicks()).InMillisecondsF()); |
| 848 state->SetDouble("5_frame_time", |
| 849 (frame_time - base::TimeTicks()).InMillisecondsF()); |
| 850 state->SetDouble("6_deadline", |
| 851 (deadline - base::TimeTicks()).InMillisecondsF()); |
| 852 state->EndDictionary(); |
| 853 |
| 837 state->EndDictionary(); | 854 state->EndDictionary(); |
| 838 | 855 |
| 839 state->BeginDictionary("client_state"); | 856 state->BeginDictionary("client_state"); |
| 840 state->SetDouble("draw_duration_estimate_ms", | 857 state->SetDouble("draw_duration_estimate_ms", |
| 841 client_->DrawDurationEstimate().InMillisecondsF()); | 858 client_->DrawDurationEstimate().InMillisecondsF()); |
| 842 state->SetDouble( | 859 state->SetDouble( |
| 843 "begin_main_frame_to_commit_duration_estimate_ms", | 860 "begin_main_frame_to_commit_duration_estimate_ms", |
| 844 client_->BeginMainFrameToCommitDurationEstimate().InMillisecondsF()); | 861 client_->BeginMainFrameToCommitDurationEstimate().InMillisecondsF()); |
| 845 state->SetDouble( | 862 state->SetDouble( |
| 846 "commit_to_activate_duration_estimate_ms", | 863 "commit_to_activate_duration_estimate_ms", |
| (...skipping 21 matching lines...) Expand all Loading... |
| 868 } | 885 } |
| 869 | 886 |
| 870 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 887 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 871 return (state_machine_.commit_state() == | 888 return (state_machine_.commit_state() == |
| 872 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 889 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
| 873 state_machine_.commit_state() == | 890 state_machine_.commit_state() == |
| 874 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 891 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
| 875 } | 892 } |
| 876 | 893 |
| 877 } // namespace cc | 894 } // namespace cc |
| OLD | NEW |