OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "components/scheduler/renderer/renderer_scheduler_impl.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/callback.h" | 9 #include "base/callback.h" |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/test/simple_test_tick_clock.h" | 11 #include "base/test/simple_test_tick_clock.h" |
10 #include "cc/output/begin_frame_args.h" | 12 #include "cc/output/begin_frame_args.h" |
11 #include "cc/test/ordered_simple_task_runner.h" | 13 #include "cc/test/ordered_simple_task_runner.h" |
12 #include "components/scheduler/base/test_time_source.h" | 14 #include "components/scheduler/base/test_time_source.h" |
13 #include "components/scheduler/child/scheduler_tqm_delegate_for_test.h" | 15 #include "components/scheduler/child/scheduler_tqm_delegate_for_test.h" |
14 #include "components/scheduler/child/scheduler_tqm_delegate_impl.h" | 16 #include "components/scheduler/child/scheduler_tqm_delegate_impl.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 mock_task_runner_ = make_scoped_refptr( | 246 mock_task_runner_ = make_scoped_refptr( |
245 new cc::OrderedSimpleTaskRunner(clock_.get(), false)); | 247 new cc::OrderedSimpleTaskRunner(clock_.get(), false)); |
246 main_task_runner_ = SchedulerTqmDelegateForTest::Create( | 248 main_task_runner_ = SchedulerTqmDelegateForTest::Create( |
247 mock_task_runner_, make_scoped_ptr(new TestTimeSource(clock_.get()))); | 249 mock_task_runner_, make_scoped_ptr(new TestTimeSource(clock_.get()))); |
248 } | 250 } |
249 Initialize( | 251 Initialize( |
250 make_scoped_ptr(new RendererSchedulerImplForTest(main_task_runner_))); | 252 make_scoped_ptr(new RendererSchedulerImplForTest(main_task_runner_))); |
251 } | 253 } |
252 | 254 |
253 void Initialize(scoped_ptr<RendererSchedulerImplForTest> scheduler) { | 255 void Initialize(scoped_ptr<RendererSchedulerImplForTest> scheduler) { |
254 scheduler_ = scheduler.Pass(); | 256 scheduler_ = std::move(scheduler); |
255 default_task_runner_ = scheduler_->DefaultTaskRunner(); | 257 default_task_runner_ = scheduler_->DefaultTaskRunner(); |
256 compositor_task_runner_ = scheduler_->CompositorTaskRunner(); | 258 compositor_task_runner_ = scheduler_->CompositorTaskRunner(); |
257 loading_task_runner_ = scheduler_->LoadingTaskRunner(); | 259 loading_task_runner_ = scheduler_->LoadingTaskRunner(); |
258 idle_task_runner_ = scheduler_->IdleTaskRunner(); | 260 idle_task_runner_ = scheduler_->IdleTaskRunner(); |
259 timer_task_runner_ = scheduler_->TimerTaskRunner(); | 261 timer_task_runner_ = scheduler_->TimerTaskRunner(); |
260 } | 262 } |
261 | 263 |
262 void TearDown() override { | 264 void TearDown() override { |
263 DCHECK(!mock_task_runner_.get() || !message_loop_.get()); | 265 DCHECK(!mock_task_runner_.get() || !message_loop_.get()); |
264 scheduler_->Shutdown(); | 266 scheduler_->Shutdown(); |
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 } | 2443 } |
2442 | 2444 |
2443 base::TimeDelta time_till_next_frame = | 2445 base::TimeDelta time_till_next_frame = |
2444 EstimatedNextFrameBegin() - clock_->NowTicks(); | 2446 EstimatedNextFrameBegin() - clock_->NowTicks(); |
2445 if (time_till_next_frame > base::TimeDelta()) | 2447 if (time_till_next_frame > base::TimeDelta()) |
2446 clock_->Advance(time_till_next_frame); | 2448 clock_->Advance(time_till_next_frame); |
2447 } | 2449 } |
2448 } | 2450 } |
2449 | 2451 |
2450 } // namespace scheduler | 2452 } // namespace scheduler |
OLD | NEW |