summaryrefslogtreecommitdiffstats
path: root/components/html_viewer/web_scheduler_impl.h
blob: e0d754f48f5a845be87df94f27d73564c6690e93 (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
// 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_HTML_VIEWER_WEB_SCHEDULER_IMPL_H_
#define COMPONENTS_HTML_VIEWER_WEB_SCHEDULER_IMPL_H_

#include "third_party/WebKit/public/platform/WebScheduler.h"
#include "third_party/WebKit/public/platform/WebThread.h"
#include "third_party/WebKit/public/platform/WebTraceLocation.h"

namespace html_viewer {

class WebSchedulerImpl : public blink::WebScheduler {
 public:
  explicit WebSchedulerImpl(
      scoped_refptr<base::SingleThreadTaskRunner> task_runner);
  virtual ~WebSchedulerImpl();

 private:
  // blink::WebScheduler overrides.
  virtual void postIdleTask(const blink::WebTraceLocation& location,
                            blink::WebThread::IdleTask* task);
  virtual void postLoadingTask(const blink::WebTraceLocation& location,
                               blink::WebThread::Task* task);
  virtual void postTimerTask(const blink::WebTraceLocation& location,
                             blink::WebThread::Task* task,
                             long long delayMs);

  static void RunIdleTask(scoped_ptr<blink::WebThread::IdleTask> task);
  static void RunTask(scoped_ptr<blink::WebThread::Task> task);

  scoped_refptr<base::SingleThreadTaskRunner> task_runner_;

  DISALLOW_COPY_AND_ASSIGN(WebSchedulerImpl);
};

}  // namespace html_viewer

#endif  // COMPONENTS_HTML_VIEWER_WEB_SCHEDULER_IMPL_H_