OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/service_manager/runner/host/service_process_launcher.h" | 5 #include "services/service_manager/runner/host/service_process_launcher.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 void ServiceProcessLauncher::DoLaunch( | 126 void ServiceProcessLauncher::DoLaunch( |
127 std::unique_ptr<base::CommandLine> child_command_line) { | 127 std::unique_ptr<base::CommandLine> child_command_line) { |
128 if (delegate_) { | 128 if (delegate_) { |
129 delegate_->AdjustCommandLineArgumentsForTarget(target_, | 129 delegate_->AdjustCommandLineArgumentsForTarget(target_, |
130 child_command_line.get()); | 130 child_command_line.get()); |
131 } | 131 } |
132 | 132 |
133 base::LaunchOptions options; | 133 base::LaunchOptions options; |
134 | |
135 base::FilePath exe_dir; | |
136 base::PathService::Get(base::DIR_EXE, &exe_dir); | |
137 options.current_directory = exe_dir; | |
138 | |
139 // The service should look for ICU data next to the service runner's | |
140 // executable rather than its own. | |
141 child_command_line->AppendSwitchPath(switches::kIcuDataDir, exe_dir); | |
142 | |
143 #if defined(OS_POSIX) | |
144 // We need the dynamic loader to be able to locate things like libbase.so | |
145 // in component builds, as well as some other dynamic runtime dependencies in | |
146 // other build environments (e.g. libosmesa.so). For this we set | |
147 // LD_LIBRARY_PATH to the service runner's executable path where such | |
148 // artifacts are typically expected to reside. | |
149 options.environ["LD_LIBRARY_PATH"] = exe_dir.value(); | |
150 #endif | |
151 | |
152 #if defined(OS_WIN) | 134 #if defined(OS_WIN) |
153 options.handles_to_inherit = &handle_passing_info_; | 135 options.handles_to_inherit = &handle_passing_info_; |
154 #if defined(OFFICIAL_BUILD) | 136 #if defined(OFFICIAL_BUILD) |
155 CHECK(false) << "Launching mojo process with inherit_handles is insecure!"; | 137 CHECK(false) << "Launching mojo process with inherit_handles is insecure!"; |
156 #endif | 138 #endif |
157 options.inherit_handles = true; | 139 options.inherit_handles = true; |
158 options.stdin_handle = INVALID_HANDLE_VALUE; | 140 options.stdin_handle = INVALID_HANDLE_VALUE; |
159 options.stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); | 141 options.stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); |
160 options.stderr_handle = GetStdHandle(STD_ERROR_HANDLE); | 142 options.stderr_handle = GetStdHandle(STD_ERROR_HANDLE); |
161 // Always inherit stdout/stderr as a pair. | 143 // Always inherit stdout/stderr as a pair. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 child_process_.Handle(), | 201 child_process_.Handle(), |
220 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle( | 202 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle( |
221 mojo_ipc_channel_->PassServerHandle().release().handle)), | 203 mojo_ipc_channel_->PassServerHandle().release().handle)), |
222 child_token_); | 204 child_token_); |
223 } | 205 } |
224 } | 206 } |
225 start_child_process_event_.Signal(); | 207 start_child_process_event_.Signal(); |
226 } | 208 } |
227 | 209 |
228 } // namespace service_manager | 210 } // namespace service_manager |
OLD | NEW |