forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
task_runner_adaptor.h
35 lines (25 loc) · 942 Bytes
/
task_runner_adaptor.h
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
// Copyright 2016 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 FLUTTER_GLU_BASE_TASK_RUNNER_H_
#define FLUTTER_GLU_BASE_TASK_RUNNER_H_
#include "base/memory/ref_counted.h"
#include "lib/ftl/tasks/task_runner.h"
namespace base {
class TaskRunner;
} // namespace base
namespace glue {
class TaskRunnerAdaptor : public ftl::TaskRunner {
public:
explicit TaskRunnerAdaptor(scoped_refptr<base::TaskRunner> runner);
void PostTask(ftl::Closure task) override;
void PostTaskForTime(ftl::Closure task, ftl::TimePoint target_time) override;
void PostDelayedTask(ftl::Closure task, ftl::TimeDelta delay) override;
bool RunsTasksOnCurrentThread() override;
protected:
~TaskRunnerAdaptor() override;
private:
scoped_refptr<base::TaskRunner> runner_;
};
} // namespace glue
#endif // FLUTTER_GLU_BASE_TASK_RUNNER_H_