| 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_task_runner_delegate_impl.h" | 5 #include "components/scheduler/child/scheduler_task_runner_delegate_impl.h" |
| 6 | 6 |
| 7 namespace scheduler { | 7 namespace scheduler { |
| 8 | 8 |
| 9 // static | 9 // static |
| 10 scoped_refptr<SchedulerTaskRunnerDelegateImpl> | 10 scoped_refptr<SchedulerTaskRunnerDelegateImpl> |
| 11 SchedulerTaskRunnerDelegateImpl::Create(base::MessageLoop* message_loop) { | 11 SchedulerTaskRunnerDelegateImpl::Create( |
| 12 return make_scoped_refptr(new SchedulerTaskRunnerDelegateImpl(message_loop)); | 12 base::MessageLoop* message_loop, |
| 13 scoped_ptr<base::TickClock> time_source) { |
| 14 return make_scoped_refptr( |
| 15 new SchedulerTaskRunnerDelegateImpl(message_loop, time_source.Pass())); |
| 13 } | 16 } |
| 14 | 17 |
| 15 SchedulerTaskRunnerDelegateImpl::SchedulerTaskRunnerDelegateImpl( | 18 SchedulerTaskRunnerDelegateImpl::SchedulerTaskRunnerDelegateImpl( |
| 16 base::MessageLoop* message_loop) | 19 base::MessageLoop* message_loop, |
| 20 scoped_ptr<base::TickClock> time_source) |
| 17 : message_loop_(message_loop), | 21 : message_loop_(message_loop), |
| 18 message_loop_task_runner_(message_loop->task_runner()) {} | 22 message_loop_task_runner_(message_loop->task_runner()), |
| 23 time_source_(time_source.Pass()) {} |
| 19 | 24 |
| 20 SchedulerTaskRunnerDelegateImpl::~SchedulerTaskRunnerDelegateImpl() { | 25 SchedulerTaskRunnerDelegateImpl::~SchedulerTaskRunnerDelegateImpl() { |
| 21 RestoreDefaultTaskRunner(); | 26 RestoreDefaultTaskRunner(); |
| 22 } | 27 } |
| 23 | 28 |
| 24 void SchedulerTaskRunnerDelegateImpl::SetDefaultTaskRunner( | 29 void SchedulerTaskRunnerDelegateImpl::SetDefaultTaskRunner( |
| 25 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 30 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
| 26 message_loop_->SetTaskRunner(task_runner); | 31 message_loop_->SetTaskRunner(task_runner); |
| 27 } | 32 } |
| 28 | 33 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 47 } | 52 } |
| 48 | 53 |
| 49 bool SchedulerTaskRunnerDelegateImpl::RunsTasksOnCurrentThread() const { | 54 bool SchedulerTaskRunnerDelegateImpl::RunsTasksOnCurrentThread() const { |
| 50 return message_loop_task_runner_->RunsTasksOnCurrentThread(); | 55 return message_loop_task_runner_->RunsTasksOnCurrentThread(); |
| 51 } | 56 } |
| 52 | 57 |
| 53 bool SchedulerTaskRunnerDelegateImpl::IsNested() const { | 58 bool SchedulerTaskRunnerDelegateImpl::IsNested() const { |
| 54 return message_loop_->IsNested(); | 59 return message_loop_->IsNested(); |
| 55 } | 60 } |
| 56 | 61 |
| 62 base::TimeTicks SchedulerTaskRunnerDelegateImpl::NowTicks() { |
| 63 return time_source_->NowTicks(); |
| 64 } |
| 65 |
| 66 void SchedulerTaskRunnerDelegateImpl::OnNoMoreWork() {} |
| 67 |
| 57 } // namespace scheduler | 68 } // namespace scheduler |
| OLD | NEW |