Rename GetIconID to GetIconId
[chromium-blink-merge.git] / components / scheduler / child / scheduler_task_runner_delegate_impl.cc
blob0c34554b10675f665d04bd6235704d73624915ff
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
3 // found in the LICENSE file.
5 #include "components/scheduler/child/scheduler_task_runner_delegate_impl.h"
7 namespace scheduler {
9 // static
10 scoped_refptr<SchedulerTaskRunnerDelegateImpl>
11 SchedulerTaskRunnerDelegateImpl::Create(base::MessageLoop* message_loop) {
12 return make_scoped_refptr(new SchedulerTaskRunnerDelegateImpl(message_loop));
15 SchedulerTaskRunnerDelegateImpl::SchedulerTaskRunnerDelegateImpl(
16 base::MessageLoop* message_loop)
17 : message_loop_(message_loop),
18 message_loop_task_runner_(message_loop->task_runner()) {}
20 SchedulerTaskRunnerDelegateImpl::~SchedulerTaskRunnerDelegateImpl() {
21 RestoreDefaultTaskRunner();
24 void SchedulerTaskRunnerDelegateImpl::SetDefaultTaskRunner(
25 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
26 message_loop_->SetTaskRunner(task_runner);
29 void SchedulerTaskRunnerDelegateImpl::RestoreDefaultTaskRunner() {
30 if (base::MessageLoop::current() == message_loop_)
31 message_loop_->SetTaskRunner(message_loop_task_runner_);
34 bool SchedulerTaskRunnerDelegateImpl::PostDelayedTask(
35 const tracked_objects::Location& from_here,
36 const base::Closure& task,
37 base::TimeDelta delay) {
38 return message_loop_task_runner_->PostDelayedTask(from_here, task, delay);
41 bool SchedulerTaskRunnerDelegateImpl::PostNonNestableDelayedTask(
42 const tracked_objects::Location& from_here,
43 const base::Closure& task,
44 base::TimeDelta delay) {
45 return message_loop_task_runner_->PostNonNestableDelayedTask(from_here, task,
46 delay);
49 bool SchedulerTaskRunnerDelegateImpl::RunsTasksOnCurrentThread() const {
50 return message_loop_task_runner_->RunsTasksOnCurrentThread();
53 bool SchedulerTaskRunnerDelegateImpl::IsNested() const {
54 return message_loop_->IsNested();
57 } // namespace scheduler