OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "mojo/shell/app_child_process.h" | 5 #include "mojo/shell/app_child_process.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // Should be created and initialized on the main thread. | 85 // Should be created and initialized on the main thread. |
86 class AppContext { | 86 class AppContext { |
87 public: | 87 public: |
88 AppContext() | 88 AppContext() |
89 : io_thread_("io_thread"), | 89 : io_thread_("io_thread"), |
90 controller_thread_("controller_thread") {} | 90 controller_thread_("controller_thread") {} |
91 ~AppContext() {} | 91 ~AppContext() {} |
92 | 92 |
93 void Init() { | 93 void Init() { |
94 // Initialize Mojo before starting any threads. | |
95 embedder::Init(); | |
96 | |
97 // Create and start our I/O thread. | 94 // Create and start our I/O thread. |
98 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0); | 95 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0); |
99 CHECK(io_thread_.StartWithOptions(io_thread_options)); | 96 CHECK(io_thread_.StartWithOptions(io_thread_options)); |
100 io_runner_ = io_thread_.message_loop_proxy().get(); | 97 io_runner_ = io_thread_.message_loop_proxy().get(); |
101 CHECK(io_runner_); | 98 CHECK(io_runner_); |
102 | 99 |
103 // Create and start our controller thread. | 100 // Create and start our controller thread. |
104 base::Thread::Options controller_thread_options; | 101 base::Thread::Options controller_thread_options; |
105 controller_thread_options.message_loop_type = | 102 controller_thread_options.message_loop_type = |
106 base::MessageLoop::TYPE_CUSTOM; | 103 base::MessageLoop::TYPE_CUSTOM; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 blocker.Block(); | 290 blocker.Block(); |
294 | 291 |
295 app_context.controller_runner()->PostTask( | 292 app_context.controller_runner()->PostTask( |
296 FROM_HERE, | 293 FROM_HERE, |
297 base::Bind(&AppChildControllerImpl::Shutdown, | 294 base::Bind(&AppChildControllerImpl::Shutdown, |
298 base::Unretained(app_context.controller()))); | 295 base::Unretained(app_context.controller()))); |
299 } | 296 } |
300 | 297 |
301 } // namespace shell | 298 } // namespace shell |
302 } // namespace mojo | 299 } // namespace mojo |
OLD | NEW |