summaryrefslogtreecommitdiffstats
path: root/components/scheduler/child/scheduler_tqm_delegate.h
blob: bb2944505715a674e18f829ce800c3db1d8bb3db (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_SCHEDULER_TQM_DELEGATE_H_
#define COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TQM_DELEGATE_H_

#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "components/scheduler/base/task_queue_manager_delegate.h"
#include "components/scheduler/scheduler_export.h"

namespace scheduler {

class SCHEDULER_EXPORT SchedulerTqmDelegate : public TaskQueueManagerDelegate {
 public:
  SchedulerTqmDelegate() {}

  // If the underlying task runner supports the concept of a default task
  // runner, the delegate should implement this function to redirect that task
  // runner to the scheduler.
  virtual void SetDefaultTaskRunner(
      scoped_refptr<base::SingleThreadTaskRunner> task_runner) = 0;

  // Similarly this method can be used to restore the original task runner when
  // the scheduler no longer wants to intercept tasks.
  virtual void RestoreDefaultTaskRunner() = 0;

 protected:
  ~SchedulerTqmDelegate() override {}

  DISALLOW_COPY_AND_ASSIGN(SchedulerTqmDelegate);
};

}  // namespace scheduler

#endif  // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TQM_DELEGATE_H_