summaryrefslogtreecommitdiff
path: root/chromium/components/scheduler/child/web_task_runner_impl.h
blob: 73a1e46fc602fe65acd1556c44e913a6b8291c3c (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
38
39
40
41
42
43
44
45
46
// 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_WEB_TASK_RUNNER_H_
#define COMPONENTS_SCHEDULER_CHILD_WEB_TASK_RUNNER_H_

#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "components/scheduler/scheduler_export.h"
#include "third_party/WebKit/public/platform/WebTaskRunner.h"

namespace base {
class SingleThreadTaskRunner;
}  // namespace base

namespace scheduler {

class SCHEDULER_EXPORT WebTaskRunnerImpl : public blink::WebTaskRunner {
 public:
  explicit WebTaskRunnerImpl(
      scoped_refptr<base::SingleThreadTaskRunner> task_runner);

  ~WebTaskRunnerImpl() override;

  const scoped_refptr<base::SingleThreadTaskRunner>& task_runner() const {
    return task_runner_;
  }

  // blink::WebTaskRunner implementation:
  void postTask(const blink::WebTraceLocation& web_location,
                blink::WebTaskRunner::Task* task) override;
  void postDelayedTask(const blink::WebTraceLocation& web_location,
                       blink::WebTaskRunner::Task* task,
                       double delayMs) override;

 private:
  scoped_refptr<base::SingleThreadTaskRunner> task_runner_;

  DISALLOW_COPY_AND_ASSIGN(WebTaskRunnerImpl);
};

}  // namespace scheduler

#endif  // COMPONENTS_SCHEDULER_CHILD_WEB_TASK_RUNNER_H_