-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecutor.h
36 lines (28 loc) · 1.08 KB
/
executor.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
36
// Copyright 2018 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef HERMES_EXECUTOR_H_
#define HERMES_EXECUTOR_H_
#include <base/memory/scoped_refptr.h>
#include <base/task/single_thread_task_runner.h>
#include <google-lpa/lpa/util/executor.h>
namespace hermes {
// Class to allow an arbitrary std::function<void()> to be executed on the
// thread of the provided MessageLoop.
class Executor : public lpa::util::Executor {
public:
explicit Executor(scoped_refptr<base::SingleThreadTaskRunner> task_runner);
void Execute(std::function<void()> f) override;
virtual void PostDelayedTask(const base::Location& from_here,
base::OnceClosure task,
base::TimeDelta delay);
protected:
// Used by MockExecutor to forward time
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner() const {
return task_runner_;
}
private:
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
};
} // namespace hermes
#endif // HERMES_EXECUTOR_H_