Chromium Code Reviews| 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::SetAllEstimatesTo(base::TimeDelta duration) { | |
| 87 begin_main_frame_to_commit_duration_ = duration; | |
| 88 commit_to_ready_to_activate_duration_ = duration; | |
| 89 prepare_tiles_duration_ = duration; | |
| 90 activate_duration_ = duration; | |
| 91 draw_duration_ = duration; | |
| 92 } | |
| 93 | |
| 86 void FakeCompositorTimingHistory::SetBeginMainFrameToCommitDurationEstimate( | 94 void FakeCompositorTimingHistory::SetBeginMainFrameToCommitDurationEstimate( |
| 87 base::TimeDelta duration) { | 95 base::TimeDelta duration) { |
| 88 begin_main_frame_to_commit_duration_ = duration; | 96 begin_main_frame_to_commit_duration_ = duration; |
| 89 } | 97 } |
| 90 | 98 |
| 91 void FakeCompositorTimingHistory::SetCommitToReadyToActivateDurationEstimate( | 99 void FakeCompositorTimingHistory::SetCommitToReadyToActivateDurationEstimate( |
| 92 base::TimeDelta duration) { | 100 base::TimeDelta duration) { |
| 93 commit_to_ready_to_activate_duration_ = duration; | 101 commit_to_ready_to_activate_duration_ = duration; |
| 94 } | 102 } |
| 95 | 103 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source, | 171 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source, |
| 164 scoped_ptr<CompositorTimingHistory> compositor_timing_history) | 172 scoped_ptr<CompositorTimingHistory> compositor_timing_history) |
| 165 : Scheduler(client, | 173 : Scheduler(client, |
| 166 scheduler_settings, | 174 scheduler_settings, |
| 167 layer_tree_host_id, | 175 layer_tree_host_id, |
| 168 task_runner, | 176 task_runner, |
| 169 external_frame_source, | 177 external_frame_source, |
| 170 synthetic_frame_source.Pass(), | 178 synthetic_frame_source.Pass(), |
| 171 unthrottled_frame_source.Pass(), | 179 unthrottled_frame_source.Pass(), |
| 172 compositor_timing_history.Pass()), | 180 compositor_timing_history.Pass()), |
| 173 now_src_(now_src) { | 181 now_src_(now_src), |
| 182 was_swap_throttled_at_last_begin_frame_(false) { | |
| 174 } | 183 } |
| 175 | 184 |
| 176 base::TimeTicks TestScheduler::Now() const { | 185 base::TimeTicks TestScheduler::Now() const { |
| 177 return now_src_->NowTicks(); | 186 return now_src_->NowTicks(); |
| 178 } | 187 } |
| 179 | 188 |
| 189 void TestScheduler::BeginImplFrameWithDeadline(const BeginFrameArgs& args) { | |
| 190 was_swap_throttled_at_last_begin_frame_ = state_machine_.SwapThrottled(); | |
|
sunnyps
2015/07/09 23:44:30
I think a better way to do this is to hook up Fake
brianderson
2015/07/10 00:34:08
I wanted to use FakeSchedulerClient::WillBeginImpl
| |
| 191 Scheduler::BeginImplFrameWithDeadline(args); | |
| 192 } | |
| 193 | |
| 180 TestScheduler::~TestScheduler() { | 194 TestScheduler::~TestScheduler() { |
| 181 } | 195 } |
| 182 | 196 |
| 183 } // namespace cc | 197 } // namespace cc |
| OLD | NEW |