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/runner/child_process.h" | 5 #include "mojo/runner/child_process.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 : io_thread_("io_thread"), controller_thread_("controller_thread") {} | 92 : io_thread_("io_thread"), controller_thread_("controller_thread") {} |
93 ~AppContext() override {} | 93 ~AppContext() override {} |
94 | 94 |
95 void Init() { | 95 void Init() { |
96 // Initialize Mojo before starting any threads. | 96 // Initialize Mojo before starting any threads. |
97 embedder::Init(make_scoped_ptr(new embedder::SimplePlatformSupport())); | 97 embedder::Init(make_scoped_ptr(new embedder::SimplePlatformSupport())); |
98 | 98 |
99 // Create and start our I/O thread. | 99 // Create and start our I/O thread. |
100 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0); | 100 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0); |
101 CHECK(io_thread_.StartWithOptions(io_thread_options)); | 101 CHECK(io_thread_.StartWithOptions(io_thread_options)); |
102 io_runner_ = io_thread_.message_loop_proxy().get(); | 102 io_runner_ = io_thread_.task_runner().get(); |
103 CHECK(io_runner_.get()); | 103 CHECK(io_runner_.get()); |
104 | 104 |
105 // Create and start our controller thread. | 105 // Create and start our controller thread. |
106 base::Thread::Options controller_thread_options; | 106 base::Thread::Options controller_thread_options; |
107 controller_thread_options.message_loop_type = | 107 controller_thread_options.message_loop_type = |
108 base::MessageLoop::TYPE_CUSTOM; | 108 base::MessageLoop::TYPE_CUSTOM; |
109 controller_thread_options.message_pump_factory = | 109 controller_thread_options.message_pump_factory = |
110 base::Bind(&common::MessagePumpMojo::Create); | 110 base::Bind(&common::MessagePumpMojo::Create); |
111 CHECK(controller_thread_.StartWithOptions(controller_thread_options)); | 111 CHECK(controller_thread_.StartWithOptions(controller_thread_options)); |
112 controller_runner_ = controller_thread_.message_loop_proxy().get(); | 112 controller_runner_ = controller_thread_.task_runner().get(); |
113 CHECK(controller_runner_.get()); | 113 CHECK(controller_runner_.get()); |
114 | 114 |
115 // TODO(vtl): This should be SLAVE, not NONE. | 115 // TODO(vtl): This should be SLAVE, not NONE. |
116 embedder::InitIPCSupport(embedder::ProcessType::NONE, controller_runner_, | 116 embedder::InitIPCSupport(embedder::ProcessType::NONE, controller_runner_, |
117 this, io_runner_, | 117 this, io_runner_, |
118 embedder::ScopedPlatformHandle()); | 118 embedder::ScopedPlatformHandle()); |
119 } | 119 } |
120 | 120 |
121 void Shutdown() { | 121 void Shutdown() { |
122 Blocker blocker; | 122 Blocker blocker; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // This will block, then run whatever the controller wants. | 301 // This will block, then run whatever the controller wants. |
302 blocker.Block(); | 302 blocker.Block(); |
303 | 303 |
304 app_context.Shutdown(); | 304 app_context.Shutdown(); |
305 | 305 |
306 return 0; | 306 return 0; |
307 } | 307 } |
308 | 308 |
309 } // namespace runner | 309 } // namespace runner |
310 } // namespace mojo | 310 } // namespace mojo |
OLD | NEW |