| 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" |
| 11 #include "base/profiler/scoped_tracker.h" | 11 #include "base/profiler/scoped_tracker.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 14 #include "base/trace_event/trace_event_argument.h" | 14 #include "base/trace_event/trace_event_argument.h" |
| 15 #include "cc/debug/devtools_instrumentation.h" | 15 #include "cc/debug/devtools_instrumentation.h" |
| 16 #include "cc/debug/traced_value.h" | 16 #include "cc/debug/traced_value.h" |
| 17 #include "cc/scheduler/delay_based_time_source.h" | 17 #include "cc/scheduler/delay_based_time_source.h" |
| 18 #include "ui/gfx/frame_time.h" | |
| 19 | 18 |
| 20 namespace cc { | 19 namespace cc { |
| 21 | 20 |
| 22 BeginFrameSource* SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( | 21 BeginFrameSource* SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( |
| 23 Scheduler* scheduler) { | 22 Scheduler* scheduler) { |
| 24 if (scheduler->settings_.use_external_begin_frame_source) { | 23 if (scheduler->settings_.use_external_begin_frame_source) { |
| 25 TRACE_EVENT1("cc", | 24 TRACE_EVENT1("cc", |
| 26 "Scheduler::Scheduler()", | 25 "Scheduler::Scheduler()", |
| 27 "PrimaryFrameSource", | 26 "PrimaryFrameSource", |
| 28 "ExternalBeginFrameSource"); | 27 "ExternalBeginFrameSource"); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 SetThrottleFrameProduction(scheduler_settings.throttle_frame_production); | 113 SetThrottleFrameProduction(scheduler_settings.throttle_frame_production); |
| 115 } | 114 } |
| 116 | 115 |
| 117 Scheduler::~Scheduler() { | 116 Scheduler::~Scheduler() { |
| 118 if (frame_source_->NeedsBeginFrames()) | 117 if (frame_source_->NeedsBeginFrames()) |
| 119 frame_source_->SetNeedsBeginFrames(false); | 118 frame_source_->SetNeedsBeginFrames(false); |
| 120 frame_source_->SetActiveSource(nullptr); | 119 frame_source_->SetActiveSource(nullptr); |
| 121 } | 120 } |
| 122 | 121 |
| 123 base::TimeTicks Scheduler::Now() const { | 122 base::TimeTicks Scheduler::Now() const { |
| 124 base::TimeTicks now = gfx::FrameTime::Now(); | 123 base::TimeTicks now = base::TimeTicks::Now(); |
| 125 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.now"), | 124 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.now"), |
| 126 "Scheduler::Now", | 125 "Scheduler::Now", |
| 127 "now", | 126 "now", |
| 128 now); | 127 now); |
| 129 return now; | 128 return now; |
| 130 } | 129 } |
| 131 | 130 |
| 132 void Scheduler::CommitVSyncParameters(base::TimeTicks timebase, | 131 void Scheduler::CommitVSyncParameters(base::TimeTicks timebase, |
| 133 base::TimeDelta interval) { | 132 base::TimeDelta interval) { |
| 134 if (authoritative_vsync_interval_ != base::TimeDelta()) { | 133 if (authoritative_vsync_interval_ != base::TimeDelta()) { |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 } | 822 } |
| 824 | 823 |
| 825 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 824 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 826 return (state_machine_.commit_state() == | 825 return (state_machine_.commit_state() == |
| 827 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 826 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
| 828 state_machine_.commit_state() == | 827 state_machine_.commit_state() == |
| 829 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 828 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
| 830 } | 829 } |
| 831 | 830 |
| 832 } // namespace cc | 831 } // namespace cc |
| OLD | NEW |