forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtask_runner_impl.h
42 lines (30 loc) · 1.11 KB
/
task_runner_impl.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
37
38
39
40
41
42
// 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 CHROMECAST_BASE_TASK_RUNNER_IMPL_H_
#define CHROMECAST_BASE_TASK_RUNNER_IMPL_H_
#include <stdint.h>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "chromecast/public/task_runner.h"
namespace base {
class SingleThreadTaskRunner;
}
namespace chromecast {
// Implementation of public TaskRunner interface that just calls
// base::ThreadTaskRunnerHandle at construction time and uses it to post.
class TaskRunnerImpl : public TaskRunner {
public:
TaskRunnerImpl();
explicit TaskRunnerImpl(scoped_refptr<base::SingleThreadTaskRunner> runner);
~TaskRunnerImpl() override;
bool PostTask(Task* task, uint64_t delay_milliseconds) override;
const scoped_refptr<base::SingleThreadTaskRunner>& runner() const {
return runner_;
}
private:
const scoped_refptr<base::SingleThreadTaskRunner> runner_;
DISALLOW_COPY_AND_ASSIGN(TaskRunnerImpl);
};
} // namespace chromecast
#endif // CHROMECAST_BASE_TASK_RUNNER_IMPL_H_