OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file "provides" abstractions for "task runners" and posting tasks to | 5 // This file provides an implementation of |mojo::platform::TaskRunner| that |
6 // them. The embedder is required to actually declare/define them in | 6 // wraps a |base::TaskRunner|. |
7 // platform_task_runner_impl.h. See below for details. | |
8 | 7 |
9 #ifndef MOJO_EDK_BASE_EDK_PLATFORM_TASK_RUNNER_IMPL_H_ | 8 #ifndef MOJO_EDK_BASE_EDK_PLATFORM_TASK_RUNNER_IMPL_H_ |
10 #define MOJO_EDK_BASE_EDK_PLATFORM_TASK_RUNNER_IMPL_H_ | 9 #define MOJO_EDK_BASE_EDK_PLATFORM_TASK_RUNNER_IMPL_H_ |
11 | 10 |
12 #include "base/macros.h" | 11 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
14 #include "base/task_runner.h" | 13 #include "base/task_runner.h" |
15 #include "mojo/edk/embedder/platform_task_runner.h" | 14 #include "mojo/edk/platform/task_runner.h" |
16 | 15 |
17 namespace base_edk { | 16 namespace base_edk { |
18 | 17 |
19 class PlatformTaskRunnerImpl : public mojo::embedder::PlatformTaskRunner { | 18 class PlatformTaskRunnerImpl : public mojo::platform::TaskRunner { |
20 public: | 19 public: |
21 explicit PlatformTaskRunnerImpl( | 20 explicit PlatformTaskRunnerImpl( |
22 scoped_refptr<base::TaskRunner>&& base_task_runner); | 21 scoped_refptr<base::TaskRunner>&& base_task_runner); |
23 ~PlatformTaskRunnerImpl() override; | 22 ~PlatformTaskRunnerImpl() override; |
24 | 23 |
25 // |mojo::embedder::PlatformTaskRunner| implementation: | 24 // |mojo::platform::TaskRunner| implementation: |
26 void PostTask(const base::Closure& task) override; | 25 void PostTask(const base::Closure& task) override; |
27 bool RunsTasksOnCurrentThread() const override; | 26 bool RunsTasksOnCurrentThread() const override; |
28 | 27 |
29 private: | 28 private: |
30 const scoped_refptr<base::TaskRunner> base_task_runner_; | 29 const scoped_refptr<base::TaskRunner> base_task_runner_; |
31 | 30 |
32 DISALLOW_COPY_AND_ASSIGN(PlatformTaskRunnerImpl); | 31 DISALLOW_COPY_AND_ASSIGN(PlatformTaskRunnerImpl); |
33 }; | 32 }; |
34 | 33 |
35 } // namespace base_edk | 34 } // namespace base_edk |
36 | 35 |
37 #endif // MOJO_EDK_BASE_EDK_PLATFORM_TASK_RUNNER_IMPL_H_ | 36 #endif // MOJO_EDK_BASE_EDK_PLATFORM_TASK_RUNNER_IMPL_H_ |
OLD | NEW |