Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: cc/scheduler/scheduler.cc

Issue 1026233002: cc: Making BeginFrameSources support multiple BeginFrameObservers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 727
728 SetupPollingMechanisms(); 728 SetupPollingMechanisms();
729 729
730 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); 730 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime());
731 731
732 RescheduleBeginImplFrameDeadlineIfNeeded(); 732 RescheduleBeginImplFrameDeadlineIfNeeded();
733 733
734 SetupNextBeginFrameIfNeeded(); 734 SetupNextBeginFrameIfNeeded();
735 } 735 }
736 736
737 scoped_refptr<base::trace_event::ConvertableToTraceFormat> Scheduler::AsValue() 737 scoped_refptr<base::trace_event::ConvertableToTraceFormat>
738 const { 738 Scheduler::AsValue() {
739 scoped_refptr<base::trace_event::TracedValue> state = 739 scoped_refptr<base::trace_event::TracedValue> state =
740 new base::trace_event::TracedValue(); 740 new base::trace_event::TracedValue();
741 AsValueInto(state.get()); 741 AsValueInto(state.get());
742 return state; 742 return state;
743 } 743 }
744 744
745 void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const { 745 void Scheduler::AsValueInto(base::trace_event::TracedValue* state) {
746 state->BeginDictionary("state_machine"); 746 state->BeginDictionary("state_machine");
747 state_machine_.AsValueInto(state); 747 state_machine_.AsValueInto(state);
748 state->EndDictionary(); 748 state->EndDictionary();
749 749
750 // Only trace frame sources when explicitly enabled - http://crbug.com/420607 750 // Only trace frame sources when explicitly enabled - http://crbug.com/420607
751 bool frame_tracing_enabled = false; 751 bool frame_tracing_enabled = false;
752 TRACE_EVENT_CATEGORY_GROUP_ENABLED( 752 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
753 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), 753 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"),
754 &frame_tracing_enabled); 754 &frame_tracing_enabled);
755 if (frame_tracing_enabled) { 755 if (frame_tracing_enabled) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 client_->DrawDurationEstimate().InMillisecondsF()); 802 client_->DrawDurationEstimate().InMillisecondsF());
803 state->SetDouble( 803 state->SetDouble(
804 "begin_main_frame_to_commit_duration_estimate_ms", 804 "begin_main_frame_to_commit_duration_estimate_ms",
805 client_->BeginMainFrameToCommitDurationEstimate().InMillisecondsF()); 805 client_->BeginMainFrameToCommitDurationEstimate().InMillisecondsF());
806 state->SetDouble( 806 state->SetDouble(
807 "commit_to_activate_duration_estimate_ms", 807 "commit_to_activate_duration_estimate_ms",
808 client_->CommitToActivateDurationEstimate().InMillisecondsF()); 808 client_->CommitToActivateDurationEstimate().InMillisecondsF());
809 state->EndDictionary(); 809 state->EndDictionary();
810 } 810 }
811 811
812 bool Scheduler::CanCommitAndActivateBeforeDeadline() const { 812 bool Scheduler::CanCommitAndActivateBeforeDeadline() {
813 // Check if the main thread computation and commit can be finished before the 813 // Check if the main thread computation and commit can be finished before the
814 // impl thread's deadline. 814 // impl thread's deadline.
815 base::TimeTicks estimated_draw_time = 815 base::TimeTicks estimated_draw_time =
816 begin_impl_frame_args_.frame_time + 816 begin_impl_frame_args_.frame_time +
817 client_->BeginMainFrameToCommitDurationEstimate() + 817 client_->BeginMainFrameToCommitDurationEstimate() +
818 client_->CommitToActivateDurationEstimate(); 818 client_->CommitToActivateDurationEstimate();
819 819
820 TRACE_EVENT2( 820 TRACE_EVENT2(
821 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), 821 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
822 "CanCommitAndActivateBeforeDeadline", 822 "CanCommitAndActivateBeforeDeadline",
823 "time_left_after_drawing_ms", 823 "time_left_after_drawing_ms",
824 (begin_impl_frame_args_.deadline - estimated_draw_time).InMillisecondsF(), 824 (begin_impl_frame_args_.deadline - estimated_draw_time).InMillisecondsF(),
825 "state", 825 "state",
826 AsValue()); 826 AsValue());
827 827
828 return estimated_draw_time < begin_impl_frame_args_.deadline; 828 return estimated_draw_time < begin_impl_frame_args_.deadline;
829 } 829 }
830 830
831 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 831 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
832 return (state_machine_.commit_state() == 832 return (state_machine_.commit_state() ==
833 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || 833 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT ||
834 state_machine_.commit_state() == 834 state_machine_.commit_state() ==
835 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); 835 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED);
836 } 836 }
837 837
838 } // namespace cc 838 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698