OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/child/scheduler_tqm_delegate_impl.h" | 5 #include "components/scheduler/child/scheduler_tqm_delegate_impl.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 namespace scheduler { | 9 namespace scheduler { |
8 | 10 |
9 // static | 11 // static |
10 scoped_refptr<SchedulerTqmDelegateImpl> SchedulerTqmDelegateImpl::Create( | 12 scoped_refptr<SchedulerTqmDelegateImpl> SchedulerTqmDelegateImpl::Create( |
11 base::MessageLoop* message_loop, | 13 base::MessageLoop* message_loop, |
12 scoped_ptr<base::TickClock> time_source) { | 14 scoped_ptr<base::TickClock> time_source) { |
13 return make_scoped_refptr( | 15 return make_scoped_refptr( |
14 new SchedulerTqmDelegateImpl(message_loop, time_source.Pass())); | 16 new SchedulerTqmDelegateImpl(message_loop, std::move(time_source))); |
15 } | 17 } |
16 | 18 |
17 SchedulerTqmDelegateImpl::SchedulerTqmDelegateImpl( | 19 SchedulerTqmDelegateImpl::SchedulerTqmDelegateImpl( |
18 base::MessageLoop* message_loop, | 20 base::MessageLoop* message_loop, |
19 scoped_ptr<base::TickClock> time_source) | 21 scoped_ptr<base::TickClock> time_source) |
20 : message_loop_(message_loop), | 22 : message_loop_(message_loop), |
21 message_loop_task_runner_(message_loop->task_runner()), | 23 message_loop_task_runner_(message_loop->task_runner()), |
22 time_source_(time_source.Pass()) {} | 24 time_source_(std::move(time_source)) {} |
23 | 25 |
24 SchedulerTqmDelegateImpl::~SchedulerTqmDelegateImpl() { | 26 SchedulerTqmDelegateImpl::~SchedulerTqmDelegateImpl() { |
25 RestoreDefaultTaskRunner(); | 27 RestoreDefaultTaskRunner(); |
26 } | 28 } |
27 | 29 |
28 void SchedulerTqmDelegateImpl::SetDefaultTaskRunner( | 30 void SchedulerTqmDelegateImpl::SetDefaultTaskRunner( |
29 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 31 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
30 message_loop_->SetTaskRunner(task_runner); | 32 message_loop_->SetTaskRunner(task_runner); |
31 } | 33 } |
32 | 34 |
(...skipping 29 matching lines...) Expand all Loading... |
62 return time_source_->NowTicks(); | 64 return time_source_->NowTicks(); |
63 } | 65 } |
64 | 66 |
65 double SchedulerTqmDelegateImpl::CurrentTimeSeconds() const { | 67 double SchedulerTqmDelegateImpl::CurrentTimeSeconds() const { |
66 return base::Time::Now().ToDoubleT(); | 68 return base::Time::Now().ToDoubleT(); |
67 } | 69 } |
68 | 70 |
69 void SchedulerTqmDelegateImpl::OnNoMoreImmediateWork() {} | 71 void SchedulerTqmDelegateImpl::OnNoMoreImmediateWork() {} |
70 | 72 |
71 } // namespace scheduler | 73 } // namespace scheduler |
OLD | NEW |