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