summaryrefslogtreecommitdiffstats
path: root/components/scheduler/child/null_worker_scheduler.h
blob: 4e0daae131d272a9e2f6cfee542601ab0b5387f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_SCHEDULER_CHILD_NULL_WORKER_SCHEDULER_H_
#define COMPONENTS_SCHEDULER_CHILD_NULL_WORKER_SCHEDULER_H_

#include "components/scheduler/child/worker_scheduler.h"

namespace scheduler {

class NullWorkerScheduler : public WorkerScheduler {
 public:
  NullWorkerScheduler();
  ~NullWorkerScheduler() override;

  scoped_refptr<TaskQueue> DefaultTaskRunner() override;
  scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() override;

  void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override;
  void RemoveTaskObserver(
      base::MessageLoop::TaskObserver* task_observer) override;
  bool CanExceedIdleDeadlineIfRequired() const override;
  bool ShouldYieldForHighPriorityWork() override;
  void Init() override;
  void Shutdown() override;

 private:
  scoped_refptr<TaskQueue> task_runner_;
  scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_;

  DISALLOW_COPY_AND_ASSIGN(NullWorkerScheduler);
};

}  // namespace scheduler

#endif  // COMPONENTS_SCHEDULER_CHILD_NULL_WORKER_SCHEDULER_H_