Move blink scheduler implementation into a component
[chromium-blink-merge.git] / components / scheduler / child / scheduler_message_loop_delegate.cc
blob8c06e3087b1747ab8b6d1fd0db17c05ae5a4da8e
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_message_loop_delegate.h"
7 namespace scheduler {
9 // static
10 scoped_refptr<SchedulerMessageLoopDelegate>
11 SchedulerMessageLoopDelegate::Create(base::MessageLoop* message_loop) {
12 return make_scoped_refptr(new SchedulerMessageLoopDelegate(message_loop));
15 SchedulerMessageLoopDelegate::SchedulerMessageLoopDelegate(
16 base::MessageLoop* message_loop)
17 : message_loop_(message_loop) {
20 SchedulerMessageLoopDelegate::~SchedulerMessageLoopDelegate() {
23 bool SchedulerMessageLoopDelegate::PostDelayedTask(
24 const tracked_objects::Location& from_here,
25 const base::Closure& task,
26 base::TimeDelta delay) {
27 return message_loop_->task_runner()->PostDelayedTask(from_here, task, delay);
30 bool SchedulerMessageLoopDelegate::PostNonNestableDelayedTask(
31 const tracked_objects::Location& from_here,
32 const base::Closure& task,
33 base::TimeDelta delay) {
34 return message_loop_->task_runner()->PostNonNestableDelayedTask(from_here,
35 task, delay);
38 bool SchedulerMessageLoopDelegate::RunsTasksOnCurrentThread() const {
39 return message_loop_->task_runner()->RunsTasksOnCurrentThread();
42 bool SchedulerMessageLoopDelegate::IsNested() const {
43 return message_loop_->IsNested();
46 } // namespace scheduler