Index: mojo/shell/task_runners.h |
diff --git a/mojo/shell/task_runners.h b/mojo/shell/task_runners.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..891d3e1bfe1fe8457e8e26c9846a4e1d1084ee8f |
--- /dev/null |
+++ b/mojo/shell/task_runners.h |
@@ -0,0 +1,53 @@ |
+// Copyright 2013 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 SHELL_TASK_RUNNERS_H_ |
+#define SHELL_TASK_RUNNERS_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/message_loop/message_loop_proxy.h" |
+#include "base/threading/thread.h" |
+ |
+namespace base { |
+class SequencedWorkerPool; |
+} |
+ |
+namespace mojo { |
+namespace shell { |
+ |
+// A context object that contains the common task runners for the shell's main |
+// process. |
+class TaskRunners { |
+ public: |
+ explicit TaskRunners( |
+ const scoped_refptr<base::SingleThreadTaskRunner>& shell_runner); |
+ ~TaskRunners(); |
+ |
+ base::SingleThreadTaskRunner* shell_runner() const { |
+ return shell_runner_.get(); |
+ } |
+ |
+ base::SingleThreadTaskRunner* io_runner() const { |
+ return io_thread_->message_loop_proxy().get(); |
+ } |
+ |
+ base::SequencedWorkerPool* blocking_pool() const { |
+ return blocking_pool_.get(); |
+ } |
+ |
+ private: |
+ scoped_refptr<base::SingleThreadTaskRunner> shell_runner_; |
+ scoped_ptr<base::Thread> io_thread_; |
+ |
+ scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TaskRunners); |
+}; |
+ |
+} // namespace shell |
+} // namespace mojo |
+ |
+#endif // SHELL_TASK_RUNNERS_H_ |