| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef SHELL_TASK_RUNNERS_H_ | 5 #ifndef SHELL_TASK_RUNNERS_H_ |
| 6 #define SHELL_TASK_RUNNERS_H_ | 6 #define SHELL_TASK_RUNNERS_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 12 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "mojo/edk/platform/platform_handle_watcher.h" |
| 13 #include "mojo/edk/platform/task_runner.h" | 16 #include "mojo/edk/platform/task_runner.h" |
| 14 #include "mojo/edk/util/ref_ptr.h" | 17 #include "mojo/edk/util/ref_ptr.h" |
| 15 | 18 |
| 16 namespace base { | 19 namespace base { |
| 17 class SequencedWorkerPool; | 20 class SequencedWorkerPool; |
| 18 } | 21 } |
| 19 | 22 |
| 20 namespace shell { | 23 namespace shell { |
| 21 | 24 |
| 22 // A context object that contains the common task runners for the shell's main | 25 // A context object that contains the common task runners for the shell's main |
| 23 // process. | 26 // process. |
| 24 class TaskRunners { | 27 class TaskRunners { |
| 25 public: | 28 public: |
| 26 explicit TaskRunners( | 29 explicit TaskRunners( |
| 27 const scoped_refptr<base::SingleThreadTaskRunner>& shell_runner); | 30 const scoped_refptr<base::SingleThreadTaskRunner>& shell_runner); |
| 28 ~TaskRunners(); | 31 ~TaskRunners(); |
| 29 | 32 |
| 30 const mojo::util::RefPtr<mojo::platform::TaskRunner>& shell_runner() const { | 33 const mojo::util::RefPtr<mojo::platform::TaskRunner>& shell_runner() const { |
| 31 return shell_runner_; | 34 return shell_runner_; |
| 32 } | 35 } |
| 33 | 36 |
| 34 const mojo::util::RefPtr<mojo::platform::TaskRunner>& io_runner() const { | 37 const mojo::util::RefPtr<mojo::platform::TaskRunner>& io_runner() const { |
| 35 return io_runner_; | 38 return io_runner_; |
| 36 } | 39 } |
| 37 | 40 |
| 41 mojo::platform::PlatformHandleWatcher* io_watcher() const { |
| 42 return io_watcher_.get(); |
| 43 } |
| 44 |
| 38 base::SequencedWorkerPool* blocking_pool() const { | 45 base::SequencedWorkerPool* blocking_pool() const { |
| 39 return blocking_pool_.get(); | 46 return blocking_pool_.get(); |
| 40 } | 47 } |
| 41 | 48 |
| 42 private: | 49 private: |
| 43 mojo::util::RefPtr<mojo::platform::TaskRunner> shell_runner_; | 50 mojo::util::RefPtr<mojo::platform::TaskRunner> shell_runner_; |
| 44 scoped_ptr<base::Thread> io_thread_; | 51 scoped_ptr<base::Thread> io_thread_; |
| 45 mojo::util::RefPtr<mojo::platform::TaskRunner> io_runner_; | 52 mojo::util::RefPtr<mojo::platform::TaskRunner> io_runner_; |
| 53 std::unique_ptr<mojo::platform::PlatformHandleWatcher> io_watcher_; |
| 46 | 54 |
| 47 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 55 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
| 48 | 56 |
| 49 DISALLOW_COPY_AND_ASSIGN(TaskRunners); | 57 DISALLOW_COPY_AND_ASSIGN(TaskRunners); |
| 50 }; | 58 }; |
| 51 | 59 |
| 52 } // namespace shell | 60 } // namespace shell |
| 53 | 61 |
| 54 #endif // SHELL_TASK_RUNNERS_H_ | 62 #endif // SHELL_TASK_RUNNERS_H_ |
| OLD | NEW |