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 #include "mojo/shell/standalone/context.h" | 5 #include "mojo/shell/standalone/context.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 36 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
37 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" | 37 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" |
38 #include "mojo/shell/connect_params.h" | 38 #include "mojo/shell/connect_params.h" |
39 #include "mojo/shell/public/cpp/names.h" | 39 #include "mojo/shell/public/cpp/names.h" |
40 #include "mojo/shell/runner/host/in_process_native_runner.h" | 40 #include "mojo/shell/runner/host/in_process_native_runner.h" |
41 #include "mojo/shell/runner/host/out_of_process_native_runner.h" | 41 #include "mojo/shell/runner/host/out_of_process_native_runner.h" |
42 #include "mojo/shell/standalone/tracer.h" | 42 #include "mojo/shell/standalone/tracer.h" |
43 #include "mojo/shell/switches.h" | 43 #include "mojo/shell/switches.h" |
44 #include "mojo/util/filename_util.h" | 44 #include "mojo/util/filename_util.h" |
45 | 45 |
| 46 #if defined(OS_MACOSX) |
| 47 #include "mojo/shell/runner/host/mach_broker.h" |
| 48 #endif |
| 49 |
46 namespace mojo { | 50 namespace mojo { |
47 namespace shell { | 51 namespace shell { |
48 namespace { | 52 namespace { |
49 | 53 |
50 // Used to ensure we only init once. | 54 // Used to ensure we only init once. |
51 class Setup { | 55 class Setup { |
52 public: | 56 public: |
53 Setup() { edk::Init(); } | 57 Setup() { edk::Init(); } |
54 | 58 |
55 ~Setup() {} | 59 ~Setup() {} |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 "mojo_runner.trace"); | 133 "mojo_runner.trace"); |
130 } | 134 } |
131 | 135 |
132 if (!init_params || init_params->init_edk) | 136 if (!init_params || init_params->init_edk) |
133 EnsureEmbedderIsInitialized(); | 137 EnsureEmbedderIsInitialized(); |
134 | 138 |
135 shell_runner_ = base::MessageLoop::current()->task_runner(); | 139 shell_runner_ = base::MessageLoop::current()->task_runner(); |
136 blocking_pool_ = | 140 blocking_pool_ = |
137 new base::SequencedWorkerPool(kMaxBlockingPoolThreads, "blocking_pool"); | 141 new base::SequencedWorkerPool(kMaxBlockingPoolThreads, "blocking_pool"); |
138 | 142 |
139 if (!init_params || init_params->init_edk) | 143 if (!init_params || init_params->init_edk) { |
140 edk::InitIPCSupport(this, io_thread_->task_runner().get()); | 144 edk::InitIPCSupport(this, io_thread_->task_runner().get()); |
| 145 #if defined(OS_MACOSX) |
| 146 edk::SetMachPortProvider(MachBroker::GetInstance()->port_provider()); |
| 147 #endif |
| 148 } |
141 | 149 |
142 scoped_ptr<NativeRunnerFactory> runner_factory; | 150 scoped_ptr<NativeRunnerFactory> runner_factory; |
143 if (command_line.HasSwitch(switches::kSingleProcess)) { | 151 if (command_line.HasSwitch(switches::kSingleProcess)) { |
144 #if defined(COMPONENT_BUILD) | 152 #if defined(COMPONENT_BUILD) |
145 LOG(ERROR) << "Running Mojo in single process component build, which isn't " | 153 LOG(ERROR) << "Running Mojo in single process component build, which isn't " |
146 << "supported because statics in apps interact. Use static build" | 154 << "supported because statics in apps interact. Use static build" |
147 << " or don't pass --single-process."; | 155 << " or don't pass --single-process."; |
148 #endif | 156 #endif |
149 runner_factory.reset( | 157 runner_factory.reset( |
150 new InProcessNativeRunnerFactory(blocking_pool_.get())); | 158 new InProcessNativeRunnerFactory(blocking_pool_.get())); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 scoped_ptr<ConnectParams> params(new ConnectParams); | 249 scoped_ptr<ConnectParams> params(new ConnectParams); |
242 params->set_source(CreateShellIdentity()); | 250 params->set_source(CreateShellIdentity()); |
243 params->set_target(Identity(name, mojom::kRootUserID)); | 251 params->set_target(Identity(name, mojom::kRootUserID)); |
244 params->set_remote_interfaces(GetProxy(&remote_interfaces)); | 252 params->set_remote_interfaces(GetProxy(&remote_interfaces)); |
245 params->set_local_interfaces(std::move(local_interfaces)); | 253 params->set_local_interfaces(std::move(local_interfaces)); |
246 shell_->Connect(std::move(params)); | 254 shell_->Connect(std::move(params)); |
247 } | 255 } |
248 | 256 |
249 } // namespace shell | 257 } // namespace shell |
250 } // namespace mojo | 258 } // namespace mojo |
OLD | NEW |