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

Side by Side Diff: content/browser/child_process_launcher.cc

Issue 7258005: Clean up users of a deprecated base::LaunchApp API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/platform_util_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/child_process_launcher.h" 5 #include "content/browser/child_process_launcher.h"
6 6
7 #include <utility> // For std::pair. 7 #include <utility> // For std::pair.
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 fds_to_map.push_back(std::make_pair( 150 fds_to_map.push_back(std::make_pair(
151 sandbox_fd, 151 sandbox_fd,
152 kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); 152 kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
153 } 153 }
154 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 154 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
155 155
156 bool launched = false; 156 bool launched = false;
157 #if defined(OS_MACOSX) 157 #if defined(OS_MACOSX)
158 // It is possible for the child process to die immediately after 158 // It is possible for the child process to die immediately after
159 // launching. To prevent leaking MachBroker map entries in this case, 159 // launching. To prevent leaking MachBroker map entries in this case,
160 // lock around all of LaunchApp(). If the child dies, the death 160 // lock around all of LaunchProcess(). If the child dies, the death
161 // notification will be processed by the MachBroker after the call to 161 // notification will be processed by the MachBroker after the call to
162 // AddPlaceholderForPid(), enabling proper cleanup. 162 // AddPlaceholderForPid(), enabling proper cleanup.
163 { // begin scope for AutoLock 163 { // begin scope for AutoLock
164 MachBroker* broker = MachBroker::GetInstance(); 164 MachBroker* broker = MachBroker::GetInstance();
165 base::AutoLock lock(broker->GetLock()); 165 base::AutoLock lock(broker->GetLock());
166 166
167 // This call to |PrepareForFork()| will start the MachBroker listener 167 // This call to |PrepareForFork()| will start the MachBroker listener
168 // thread, if it is not already running. Therefore the browser process 168 // thread, if it is not already running. Therefore the browser process
169 // will be listening for Mach IPC before LaunchApp() is called. 169 // will be listening for Mach IPC before LaunchProcess() is called.
170 broker->PrepareForFork(); 170 broker->PrepareForFork();
171 #endif 171 #endif
172
172 // Actually launch the app. 173 // Actually launch the app.
173 launched = base::LaunchApp(cmd_line->argv(), env, fds_to_map, 174 base::LaunchOptions options;
174 /* wait= */false, &handle); 175 options.environ = &env;
Mark Mentovai 2011/07/11 23:12:39 Needed? Looks like env is empty.
176 options.fds_to_remap = &fds_to_map;
177 options.process_handle = &handle;
178 launched = base::LaunchProcess(*cmd_line, options);
179
175 #if defined(OS_MACOSX) 180 #if defined(OS_MACOSX)
176 if (launched) 181 if (launched)
177 broker->AddPlaceholderForPid(handle); 182 broker->AddPlaceholderForPid(handle);
178 } // end scope for AutoLock 183 } // end scope for AutoLock
179 #endif 184 #endif
180 if (!launched) 185 if (!launched)
181 handle = base::kNullProcessHandle; 186 handle = base::kNullProcessHandle;
182 } 187 }
183 #endif // else defined(OS_POSIX) 188 #endif // else defined(OS_POSIX)
184 189
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 &ChildProcessLauncher::Context::SetProcessBackgrounded, 373 &ChildProcessLauncher::Context::SetProcessBackgrounded,
369 background)); 374 background));
370 } 375 }
371 376
372 void ChildProcessLauncher::SetTerminateChildOnShutdown( 377 void ChildProcessLauncher::SetTerminateChildOnShutdown(
373 bool terminate_on_shutdown) { 378 bool terminate_on_shutdown) {
374 if (context_) 379 if (context_)
375 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); 380 context_->set_terminate_child_on_shutdown(terminate_on_shutdown);
376 } 381 }
377 382
OLDNEW
« no previous file with comments | « chrome/browser/platform_util_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698