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/null_task_queue.h"
9 NullTaskQueue::NullTaskQueue(
10 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner
)
11 : task_runner_(task_runner
) {}
13 NullTaskQueue::~NullTaskQueue() {}
15 bool NullTaskQueue::RunsTasksOnCurrentThread() const {
16 return task_runner_
->RunsTasksOnCurrentThread();
19 bool NullTaskQueue::PostDelayedTask(const tracked_objects::Location
& from_here
,
20 const base::Closure
& task
,
21 base::TimeDelta delay
) {
22 return task_runner_
->PostDelayedTask(from_here
, task
, delay
);
25 bool NullTaskQueue::PostNonNestableDelayedTask(
26 const tracked_objects::Location
& from_here
,
27 const base::Closure
& task
,
28 base::TimeDelta delay
) {
29 return task_runner_
->PostNonNestableDelayedTask(from_here
, task
, delay
);
32 bool NullTaskQueue::PostDelayedTaskAt(
33 const tracked_objects::Location
& from_here
,
34 const base::Closure
& task
,
35 base::TimeTicks desired_run_time
) {
36 // Note: this loses the guarantee of monotonicity but we can't do any better
37 // with base::TaskRunner.
38 return task_runner_
->PostDelayedTask(
39 from_here
, task
, desired_run_time
- base::TimeTicks::Now());
42 bool NullTaskQueue::IsQueueEnabled() const {
46 TaskQueue::QueueState
NullTaskQueue::GetQueueState() const {
47 return QueueState::EMPTY
;
50 const char* NullTaskQueue::GetName() const {
54 void NullTaskQueue::SetQueuePriority(QueuePriority priority
) {}
56 void NullTaskQueue::PumpQueue() {}
58 void NullTaskQueue::SetPumpPolicy(PumpPolicy pump_policy
) {}
60 } // namespace scheduler