| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/test/scheduler_test_common.h" | 5 #include "cc/test/scheduler_test_common.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "cc/debug/rendering_stats_instrumentation.h" | 10 #include "cc/debug/rendering_stats_instrumentation.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 FakeCompositorTimingHistory::FakeCompositorTimingHistory( | 76 FakeCompositorTimingHistory::FakeCompositorTimingHistory( |
| 77 scoped_ptr<RenderingStatsInstrumentation> rendering_stats_instrumentation) | 77 scoped_ptr<RenderingStatsInstrumentation> rendering_stats_instrumentation) |
| 78 : CompositorTimingHistory(rendering_stats_instrumentation.get()), | 78 : CompositorTimingHistory(rendering_stats_instrumentation.get()), |
| 79 rendering_stats_instrumentation_owned_( | 79 rendering_stats_instrumentation_owned_( |
| 80 rendering_stats_instrumentation.Pass()) { | 80 rendering_stats_instrumentation.Pass()) { |
| 81 } | 81 } |
| 82 | 82 |
| 83 FakeCompositorTimingHistory::~FakeCompositorTimingHistory() { | 83 FakeCompositorTimingHistory::~FakeCompositorTimingHistory() { |
| 84 } | 84 } |
| 85 | 85 |
| 86 void FakeCompositorTimingHistory::SetDrawDurationEstimate( |
| 87 base::TimeDelta duration) { |
| 88 draw_duration_ = duration; |
| 89 } |
| 90 |
| 86 void FakeCompositorTimingHistory::SetBeginMainFrameToCommitDurationEstimate( | 91 void FakeCompositorTimingHistory::SetBeginMainFrameToCommitDurationEstimate( |
| 87 base::TimeDelta duration) { | 92 base::TimeDelta duration) { |
| 88 begin_main_frame_to_commit_duration_ = duration; | 93 begin_main_frame_to_commit_duration_ = duration; |
| 89 } | 94 } |
| 90 | 95 |
| 91 void FakeCompositorTimingHistory::SetCommitToReadyToActivateDurationEstimate( | 96 void FakeCompositorTimingHistory::SetCommitToActivateDurationEstimate( |
| 92 base::TimeDelta duration) { | 97 base::TimeDelta duration) { |
| 93 commit_to_ready_to_activate_duration_ = duration; | 98 commit_to_activate_duration_ = duration; |
| 94 } | 99 } |
| 95 | 100 |
| 96 void FakeCompositorTimingHistory::SetPrepareTilesDurationEstimate( | 101 base::TimeDelta FakeCompositorTimingHistory::DrawDurationEstimate() const { |
| 97 base::TimeDelta duration) { | 102 return draw_duration_; |
| 98 prepare_tiles_duration_ = duration; | |
| 99 } | |
| 100 | |
| 101 void FakeCompositorTimingHistory::SetActivateDurationEstimate( | |
| 102 base::TimeDelta duration) { | |
| 103 activate_duration_ = duration; | |
| 104 } | |
| 105 | |
| 106 void FakeCompositorTimingHistory::SetDrawDurationEstimate( | |
| 107 base::TimeDelta duration) { | |
| 108 draw_duration_ = duration; | |
| 109 } | 103 } |
| 110 | 104 |
| 111 base::TimeDelta | 105 base::TimeDelta |
| 112 FakeCompositorTimingHistory::BeginMainFrameToCommitDurationEstimate() const { | 106 FakeCompositorTimingHistory::BeginMainFrameToCommitDurationEstimate() const { |
| 113 return begin_main_frame_to_commit_duration_; | 107 return begin_main_frame_to_commit_duration_; |
| 114 } | 108 } |
| 115 | 109 |
| 116 base::TimeDelta | 110 base::TimeDelta FakeCompositorTimingHistory::CommitToActivateDurationEstimate() |
| 117 FakeCompositorTimingHistory::CommitToReadyToActivateDurationEstimate() const { | |
| 118 return commit_to_ready_to_activate_duration_; | |
| 119 } | |
| 120 | |
| 121 base::TimeDelta FakeCompositorTimingHistory::PrepareTilesDurationEstimate() | |
| 122 const { | 111 const { |
| 123 return prepare_tiles_duration_; | 112 return commit_to_activate_duration_; |
| 124 } | |
| 125 | |
| 126 base::TimeDelta FakeCompositorTimingHistory::ActivateDurationEstimate() const { | |
| 127 return activate_duration_; | |
| 128 } | |
| 129 | |
| 130 base::TimeDelta FakeCompositorTimingHistory::DrawDurationEstimate() const { | |
| 131 return draw_duration_; | |
| 132 } | 113 } |
| 133 | 114 |
| 134 scoped_ptr<TestScheduler> TestScheduler::Create( | 115 scoped_ptr<TestScheduler> TestScheduler::Create( |
| 135 base::SimpleTestTickClock* now_src, | 116 base::SimpleTestTickClock* now_src, |
| 136 SchedulerClient* client, | 117 SchedulerClient* client, |
| 137 const SchedulerSettings& settings, | 118 const SchedulerSettings& settings, |
| 138 int layer_tree_host_id, | 119 int layer_tree_host_id, |
| 139 OrderedSimpleTaskRunner* task_runner, | 120 OrderedSimpleTaskRunner* task_runner, |
| 140 BeginFrameSource* external_frame_source, | 121 BeginFrameSource* external_frame_source, |
| 141 scoped_ptr<CompositorTimingHistory> compositor_timing_history) { | 122 scoped_ptr<CompositorTimingHistory> compositor_timing_history) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 155 } |
| 175 | 156 |
| 176 base::TimeTicks TestScheduler::Now() const { | 157 base::TimeTicks TestScheduler::Now() const { |
| 177 return now_src_->NowTicks(); | 158 return now_src_->NowTicks(); |
| 178 } | 159 } |
| 179 | 160 |
| 180 TestScheduler::~TestScheduler() { | 161 TestScheduler::~TestScheduler() { |
| 181 } | 162 } |
| 182 | 163 |
| 183 } // namespace cc | 164 } // namespace cc |
| OLD | NEW |