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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" |
12 #include "cc/debug/rendering_stats_instrumentation.h" | 13 #include "cc/debug/rendering_stats_instrumentation.h" |
13 | 14 |
14 namespace cc { | 15 namespace cc { |
15 | 16 |
16 void FakeDelayBasedTimeSourceClient::OnTimerTick() { | 17 void FakeDelayBasedTimeSourceClient::OnTimerTick() { |
17 tick_called_ = true; | 18 tick_called_ = true; |
18 } | 19 } |
19 | 20 |
20 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } | 21 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } |
21 | 22 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 OrderedSimpleTaskRunner* task_runner, | 66 OrderedSimpleTaskRunner* task_runner, |
66 base::TimeDelta initial_interval) | 67 base::TimeDelta initial_interval) |
67 : SyntheticBeginFrameSource( | 68 : SyntheticBeginFrameSource( |
68 TestDelayBasedTimeSource::Create(now_src, | 69 TestDelayBasedTimeSource::Create(now_src, |
69 initial_interval, | 70 initial_interval, |
70 task_runner)) {} | 71 task_runner)) {} |
71 | 72 |
72 TestSyntheticBeginFrameSource::~TestSyntheticBeginFrameSource() { | 73 TestSyntheticBeginFrameSource::~TestSyntheticBeginFrameSource() { |
73 } | 74 } |
74 | 75 |
75 scoped_ptr<FakeCompositorTimingHistory> FakeCompositorTimingHistory::Create( | 76 std::unique_ptr<FakeCompositorTimingHistory> |
| 77 FakeCompositorTimingHistory::Create( |
76 bool using_synchronous_renderer_compositor) { | 78 bool using_synchronous_renderer_compositor) { |
77 scoped_ptr<RenderingStatsInstrumentation> rendering_stats_instrumentation = | 79 std::unique_ptr<RenderingStatsInstrumentation> |
78 RenderingStatsInstrumentation::Create(); | 80 rendering_stats_instrumentation = RenderingStatsInstrumentation::Create(); |
79 return make_scoped_ptr(new FakeCompositorTimingHistory( | 81 return base::WrapUnique(new FakeCompositorTimingHistory( |
80 using_synchronous_renderer_compositor, | 82 using_synchronous_renderer_compositor, |
81 std::move(rendering_stats_instrumentation))); | 83 std::move(rendering_stats_instrumentation))); |
82 } | 84 } |
83 | 85 |
84 FakeCompositorTimingHistory::FakeCompositorTimingHistory( | 86 FakeCompositorTimingHistory::FakeCompositorTimingHistory( |
85 bool using_synchronous_renderer_compositor, | 87 bool using_synchronous_renderer_compositor, |
86 scoped_ptr<RenderingStatsInstrumentation> rendering_stats_instrumentation) | 88 std::unique_ptr<RenderingStatsInstrumentation> |
| 89 rendering_stats_instrumentation) |
87 : CompositorTimingHistory(using_synchronous_renderer_compositor, | 90 : CompositorTimingHistory(using_synchronous_renderer_compositor, |
88 CompositorTimingHistory::NULL_UMA, | 91 CompositorTimingHistory::NULL_UMA, |
89 rendering_stats_instrumentation.get()), | 92 rendering_stats_instrumentation.get()), |
90 rendering_stats_instrumentation_owned_( | 93 rendering_stats_instrumentation_owned_( |
91 std::move(rendering_stats_instrumentation)) {} | 94 std::move(rendering_stats_instrumentation)) {} |
92 | 95 |
93 FakeCompositorTimingHistory::~FakeCompositorTimingHistory() { | 96 FakeCompositorTimingHistory::~FakeCompositorTimingHistory() { |
94 } | 97 } |
95 | 98 |
96 void FakeCompositorTimingHistory::SetAllEstimatesTo(base::TimeDelta duration) { | 99 void FakeCompositorTimingHistory::SetAllEstimatesTo(base::TimeDelta duration) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return draw_duration_; | 189 return draw_duration_; |
187 } | 190 } |
188 | 191 |
189 TestScheduler::TestScheduler( | 192 TestScheduler::TestScheduler( |
190 base::SimpleTestTickClock* now_src, | 193 base::SimpleTestTickClock* now_src, |
191 SchedulerClient* client, | 194 SchedulerClient* client, |
192 const SchedulerSettings& scheduler_settings, | 195 const SchedulerSettings& scheduler_settings, |
193 int layer_tree_host_id, | 196 int layer_tree_host_id, |
194 OrderedSimpleTaskRunner* task_runner, | 197 OrderedSimpleTaskRunner* task_runner, |
195 BeginFrameSource* begin_frame_source, | 198 BeginFrameSource* begin_frame_source, |
196 scoped_ptr<CompositorTimingHistory> compositor_timing_history) | 199 std::unique_ptr<CompositorTimingHistory> compositor_timing_history) |
197 : Scheduler(client, | 200 : Scheduler(client, |
198 scheduler_settings, | 201 scheduler_settings, |
199 layer_tree_host_id, | 202 layer_tree_host_id, |
200 task_runner, | 203 task_runner, |
201 begin_frame_source, | 204 begin_frame_source, |
202 std::move(compositor_timing_history)), | 205 std::move(compositor_timing_history)), |
203 now_src_(now_src) {} | 206 now_src_(now_src) {} |
204 | 207 |
205 base::TimeTicks TestScheduler::Now() const { | 208 base::TimeTicks TestScheduler::Now() const { |
206 return now_src_->NowTicks(); | 209 return now_src_->NowTicks(); |
207 } | 210 } |
208 | 211 |
209 TestScheduler::~TestScheduler() { | 212 TestScheduler::~TestScheduler() { |
210 } | 213 } |
211 | 214 |
212 } // namespace cc | 215 } // namespace cc |
OLD | NEW |