Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: services/service_manager/runner/host/service_process_launcher.cc

Issue 2651953002: Revert of [Service Manager] Get rid of dynamic service discovery (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
134 #if defined(OS_WIN) 152 #if defined(OS_WIN)
135 options.handles_to_inherit = &handle_passing_info_; 153 options.handles_to_inherit = &handle_passing_info_;
136 #if defined(OFFICIAL_BUILD) 154 #if defined(OFFICIAL_BUILD)
137 CHECK(false) << "Launching mojo process with inherit_handles is insecure!"; 155 CHECK(false) << "Launching mojo process with inherit_handles is insecure!";
138 #endif 156 #endif
139 options.inherit_handles = true; 157 options.inherit_handles = true;
140 options.stdin_handle = INVALID_HANDLE_VALUE; 158 options.stdin_handle = INVALID_HANDLE_VALUE;
141 options.stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); 159 options.stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
142 options.stderr_handle = GetStdHandle(STD_ERROR_HANDLE); 160 options.stderr_handle = GetStdHandle(STD_ERROR_HANDLE);
143 // Always inherit stdout/stderr as a pair. 161 // Always inherit stdout/stderr as a pair.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 child_process_.Handle(), 219 child_process_.Handle(),
202 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle( 220 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle(
203 mojo_ipc_channel_->PassServerHandle().release().handle)), 221 mojo_ipc_channel_->PassServerHandle().release().handle)),
204 child_token_); 222 child_token_);
205 } 223 }
206 } 224 }
207 start_child_process_event_.Signal(); 225 start_child_process_event_.Signal();
208 } 226 }
209 227
210 } // namespace service_manager 228 } // namespace service_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698