Change base::LaunchProcess API slightly
Rather than passing the out param process handle via the options,
take it as a function argument. This simplifies many callers.
BUG=88990
Review URL: http://codereview.chromium.org/7377012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92701 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/process_util.h b/base/process_util.h
index 3d06f83..234bb4f 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -195,8 +195,9 @@
typedef std::vector<std::pair<int, int> > file_handle_mapping_vector;
// Options for launching a subprocess that are passed to LaunchApp().
+// The default constructor constructs the object with default options.
struct LaunchOptions {
- LaunchOptions() : wait(false), process_handle(NULL),
+ LaunchOptions() : wait(false),
#if defined(OS_WIN)
start_hidden(false), inherit_handles(false), as_user(NULL),
empty_desktop_name(false)
@@ -208,13 +209,6 @@
// If true, wait for the process to complete.
bool wait;
- // If non-NULL, will be filled in with the handle of the launched process.
- // NOTE: In this case, the caller is responsible for closing the handle so
- // that it doesn't leak! Otherwise, the handle will be implicitly
- // closed.
- // Not especially useful unless |wait| is false.
- ProcessHandle* process_handle;
-
#if defined(OS_WIN)
bool start_hidden;
@@ -253,7 +247,12 @@
};
// Launch a process via the command line |cmdline|.
-// See the documentation of LaunchOptions for details on launching options.
+// See the documentation of LaunchOptions for details on |options|.
+//
+// If |process_handle| is non-NULL, it will be filled in with the
+// handle of the launched process. NOTE: In this case, the caller is
+// responsible for closing the handle so that it doesn't leak!
+// Otherwise, the process handle will be implicitly closed.
//
// Unix-specific notes:
// - Before launching, all FDs open in the parent process will be marked as
@@ -261,7 +260,8 @@
// - If the first argument on the command line does not contain a slash,
// PATH will be searched. (See man execvp.)
BASE_API bool LaunchProcess(const CommandLine& cmdline,
- const LaunchOptions& options);
+ const LaunchOptions& options,
+ ProcessHandle* process_handle);
#if defined(OS_WIN)
@@ -288,7 +288,8 @@
// Example (including literal quotes)
// cmdline = "c:\windows\explorer.exe" -foo "c:\bar\"
BASE_API bool LaunchProcess(const string16& cmdline,
- const LaunchOptions& options);
+ const LaunchOptions& options,
+ ProcessHandle* process_handle);
// TODO(evan): deprecated; change callers to use LaunchProcess, remove.
inline bool LaunchApp(const std::wstring& cmdline,
@@ -297,8 +298,7 @@
LaunchOptions options;
options.wait = wait;
options.start_hidden = start_hidden;
- options.process_handle = process_handle;
- return LaunchProcess(cmdline, options);
+ return LaunchProcess(cmdline, options, process_handle);
}
// TODO(evan): deprecated; change callers to use LaunchProcess, remove.
@@ -308,9 +308,8 @@
LaunchOptions options;
options.wait = wait;
options.start_hidden = start_hidden;
- options.process_handle = process_handle;
options.inherit_handles = true;
- return LaunchProcess(cmdline, options);
+ return LaunchProcess(cmdline, options, process_handle);
}
// TODO(evan): deprecated; change callers to use LaunchProcess, remove.
@@ -320,9 +319,8 @@
ProcessHandle* process_handle) {
LaunchOptions options;
options.start_hidden = start_hidden;
- options.process_handle = process_handle;
options.as_user = token;
- return LaunchProcess(cmdline, options);
+ return LaunchProcess(cmdline, options, process_handle);
}
// TODO(evan): deprecated; change callers to use LaunchProcess, remove.
@@ -332,11 +330,10 @@
bool empty_desktop_name, bool inherit_handles) {
LaunchOptions options;
options.start_hidden = start_hidden;
- options.process_handle = process_handle;
options.as_user = token;
options.empty_desktop_name = empty_desktop_name;
options.inherit_handles = inherit_handles;
- return LaunchProcess(cmdline, options);
+ return LaunchProcess(cmdline, options, process_handle);
}
#elif defined(OS_POSIX)
@@ -345,7 +342,8 @@
// control the command line arguments directly, but prefer the
// CommandLine version if launching Chrome itself.
BASE_API bool LaunchProcess(const std::vector<std::string>& argv,
- const LaunchOptions& options);
+ const LaunchOptions& options,
+ ProcessHandle* process_handle);
// AlterEnvironment returns a modified environment vector, constructed from the
// given environment and the list of changes given in |changes|. Each key in
@@ -365,9 +363,8 @@
ProcessHandle* process_handle) {
LaunchOptions options;
options.wait = wait;
- options.process_handle = process_handle;
-
- return LaunchProcess(cl, options);
+ options.start_hidden = start_hidden;
+ return LaunchProcess(cl, options, process_handle);
}
#endif
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index 0e116de..0fc8c0e 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -528,7 +528,8 @@
}
bool LaunchProcess(const std::vector<std::string>& argv,
- const LaunchOptions& options) {
+ const LaunchOptions& options,
+ ProcessHandle* process_handle) {
pid_t pid;
InjectiveMultimap fd_shuffle1, fd_shuffle2;
if (options.fds_to_remap) {
@@ -631,16 +632,17 @@
DPCHECK(ret > 0);
}
- if (options.process_handle)
- *options.process_handle = pid;
+ if (process_handle)
+ *process_handle = pid;
}
return true;
}
bool LaunchProcess(const CommandLine& cmdline,
- const LaunchOptions& options) {
- return LaunchProcess(cmdline.argv(), options);
+ const LaunchOptions& options,
+ ProcessHandle* process_handle) {
+ return LaunchProcess(cmdline.argv(), options, process_handle);
}
ProcessMetrics::~ProcessMetrics() { }
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 826a82b..5256b37c 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -511,7 +511,7 @@
options.wait = true;
options.environ = &env_changes;
options.fds_to_remap = &fds_to_remap;
- EXPECT_TRUE(base::LaunchProcess(args, options));
+ EXPECT_TRUE(base::LaunchProcess(args, options, NULL));
PCHECK(HANDLE_EINTR(close(fds[1])) == 0);
char buf[512];
diff --git a/base/process_util_win.cc b/base/process_util_win.cc
index c11878e..9aa7f447 100644
--- a/base/process_util_win.cc
+++ b/base/process_util_win.cc
@@ -218,7 +218,8 @@
}
bool LaunchProcess(const string16& cmdline,
- const LaunchOptions& options) {
+ const LaunchOptions& options,
+ ProcessHandle* process_handle) {
STARTUPINFO startup_info = {};
startup_info.cb = sizeof(startup_info);
if (options.empty_desktop_name)
@@ -259,8 +260,8 @@
WaitForSingleObject(process_info.hProcess, INFINITE);
// If the caller wants the process handle, we won't close it.
- if (options.process_handle) {
- *options.process_handle = process_info.hProcess;
+ if (process_handle) {
+ *process_handle = process_info.hProcess;
} else {
CloseHandle(process_info.hProcess);
}
@@ -268,8 +269,9 @@
}
bool LaunchProcess(const CommandLine& cmdline,
- const LaunchOptions& options) {
- return LaunchProcess(cmdline.command_line_string(), options);
+ const LaunchOptions& options,
+ ProcessHandle* process_handle) {
+ return LaunchProcess(cmdline.command_line_string(), options, process_handle);
}
// Attempts to kill the process identified by the given process
diff --git a/base/test/multiprocess_test.cc b/base/test/multiprocess_test.cc
index c691b5f1..97f335c 100644
--- a/base/test/multiprocess_test.cc
+++ b/base/test/multiprocess_test.cc
@@ -47,13 +47,12 @@
bool debug_on_start) {
ProcessHandle handle = kNullProcessHandle;
base::LaunchOptions options;
- options.process_handle = &handle;
#if defined(OS_WIN)
options.start_hidden = true;
#else
options.fds_to_remap = &fds_to_map;
#endif
- base::LaunchProcess(MakeCmdLine(procname, debug_on_start), options);
+ base::LaunchProcess(MakeCmdLine(procname, debug_on_start), options, &handle);
return handle;
}
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 6db9e6e..78d5ab4 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -926,7 +926,7 @@
CommandLine new_command_line = parameters.command_line_;
new_command_line.AppendSwitchPath(switches::kUserDataDir,
new_user_data_dir);
- base::LaunchProcess(new_command_line, base::LaunchOptions());
+ base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL);
}
#else
// TODO(port): fix this. See comments near the definition of
diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc
index 0cb0441..3611b21 100644
--- a/chrome/browser/browser_main_win.cc
+++ b/chrome/browser/browser_main_win.cc
@@ -266,7 +266,7 @@
uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall);
uninstall_cmd.AppendSwitch(
installer::switches::kDoNotRemoveSharedItems);
- base::LaunchProcess(uninstall_cmd, base::LaunchOptions());
+ base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL);
}
return true;
}
diff --git a/chrome/browser/chromeos/input_method/input_method_manager.cc b/chrome/browser/chromeos/input_method/input_method_manager.cc
index 6270612..f84fb9a 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager.cc
+++ b/chrome/browser/chromeos/input_method/input_method_manager.cc
@@ -762,9 +762,7 @@
// TODO(zork): export "LD_PRELOAD=/usr/lib/libcrash.so"
base::SplitString(command_line, ' ', &argv);
- base::LaunchOptions options;
- options.process_handle = &handle;
- if (!base::LaunchProcess(argv, options)) {
+ if (!base::LaunchProcess(argv, base::LaunchOptions(), &handle)) {
LOG(ERROR) << "Could not launch: " << command_line;
return false;
}
diff --git a/chrome/browser/chromeos/input_method/xkeyboard.cc b/chrome/browser/chromeos/input_method/xkeyboard.cc
index ef3245fd..60b44e43 100644
--- a/chrome/browser/chromeos/input_method/xkeyboard.cc
+++ b/chrome/browser/chromeos/input_method/xkeyboard.cc
@@ -282,9 +282,7 @@
argv.push_back(layout_to_set);
argv.push_back("-synch");
- base::LaunchOptions options;
- options.process_handle = &handle;
- if (!base::LaunchProcess(argv, options)) {
+ if (!base::LaunchProcess(argv, base::LaunchOptions(), &handle)) {
LOG(ERROR) << "Failed to execute setxkbmap: " << layout_to_set;
execute_queue_ = std::queue<std::string>(); // clear the queue.
return;
diff --git a/chrome/browser/chromeos/system/touchpad_settings.cc b/chrome/browser/chromeos/system/touchpad_settings.cc
index e7d2989f..af34a2c7 100644
--- a/chrome/browser/chromeos/system/touchpad_settings.cc
+++ b/chrome/browser/chromeos/system/touchpad_settings.cc
@@ -36,7 +36,7 @@
base::LaunchOptions options;
options.wait = false; // Launch asynchronously.
- base::LaunchProcess(CommandLine(argv), options);
+ base::LaunchProcess(CommandLine(argv), options, NULL);
}
void SetTapToClick(bool enabled) {
@@ -56,7 +56,7 @@
base::LaunchOptions options;
options.wait = false; // Launch asynchronously.
- base::LaunchProcess(CommandLine(argv), options);
+ base::LaunchProcess(CommandLine(argv), options, NULL);
}
} // namespace touchpad_settings
diff --git a/chrome/browser/first_run/first_run_gtk.cc b/chrome/browser/first_run/first_run_gtk.cc
index 9051456..bb79830c 100644
--- a/chrome/browser/first_run/first_run_gtk.cc
+++ b/chrome/browser/first_run/first_run_gtk.cc
@@ -43,7 +43,7 @@
// for the process to return.
base::LaunchOptions options;
options.wait = true;
- return base::LaunchProcess(import_cmd, options);
+ return base::LaunchProcess(import_cmd, options, NULL);
}
// static
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index 3d0eb3f..2a62ad7 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -145,9 +145,8 @@
cl.AppendSwitch(switches::kChromeFrame);
}
- base::LaunchOptions options;
- options.process_handle = &ph;
- if (!base::LaunchProcess(cl, options))
+ // TODO(evan): should this use options.wait = true?
+ if (!base::LaunchProcess(cl, base::LaunchOptions(), &ph))
return false;
DWORD wr = ::WaitForSingleObject(ph, INFINITE);
if (wr != WAIT_OBJECT_0)
@@ -344,9 +343,7 @@
// Time to launch the process that is going to do the import.
base::ProcessHandle import_process;
- base::LaunchOptions options;
- options.process_handle = &import_process;
- if (!base::LaunchProcess(import_cmd, options))
+ if (!base::LaunchProcess(import_cmd, base::LaunchOptions(), &import_process))
return false;
// We block inside the import_runner ctor, pumping messages until the
diff --git a/chrome/browser/first_run/upgrade_util_linux.cc b/chrome/browser/first_run/upgrade_util_linux.cc
index cf6bc21b..62aacf4 100644
--- a/chrome/browser/first_run/upgrade_util_linux.cc
+++ b/chrome/browser/first_run/upgrade_util_linux.cc
@@ -23,8 +23,7 @@
namespace upgrade_util {
bool RelaunchChromeBrowser(const CommandLine& command_line) {
- base::LaunchOptions options;
- return base::LaunchProcess(command_line, options);
+ return base::LaunchProcess(command_line, base::LaunchOptions(), NULL);
}
bool IsUpdatePendingRestart() {
diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc
index e9ee00e..9be8143 100644
--- a/chrome/browser/first_run/upgrade_util_win.cc
+++ b/chrome/browser/first_run/upgrade_util_win.cc
@@ -64,7 +64,7 @@
bool RelaunchChromeBrowser(const CommandLine& command_line) {
scoped_ptr<base::Environment> env(base::Environment::Create());
env->UnSetVar(chrome::kChromeVersionEnvVar);
- return base::LaunchProcess(command_line, base::LaunchOptions());
+ return base::LaunchProcess(command_line, base::LaunchOptions(), NULL);
}
bool IsUpdatePendingRestart() {
diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
index f89c297..09a29a4 100644
--- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
+++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
@@ -57,8 +57,7 @@
options.environ = &env;
options.fds_to_remap = &fds_to_map;
options.wait = debug_on_start;
- options.process_handle = handle;
- return base::LaunchProcess(cl.argv(), options);
+ return base::LaunchProcess(cl.argv(), options, handle);
}
} // namespace
diff --git a/chrome/browser/mac/relauncher.cc b/chrome/browser/mac/relauncher.cc
index 07f8e79..d5ce3238 100644
--- a/chrome/browser/mac/relauncher.cc
+++ b/chrome/browser/mac/relauncher.cc
@@ -155,7 +155,7 @@
base::LaunchOptions options;
options.fds_to_remap = &fd_map;
- if (!base::LaunchProcess(relaunch_args, options)) {
+ if (!base::LaunchProcess(relaunch_args, options, NULL)) {
LOG(ERROR) << "base::LaunchProcess failed";
return false;
}
diff --git a/chrome/browser/platform_util_linux.cc b/chrome/browser/platform_util_linux.cc
index eb1dbc9..e93cc0f0 100644
--- a/chrome/browser/platform_util_linux.cc
+++ b/chrome/browser/platform_util_linux.cc
@@ -35,12 +35,10 @@
env.push_back(std::make_pair("GNOME_DISABLE_CRASH_DIALOG", ""));
}
- base::file_handle_mapping_vector no_files;
base::ProcessHandle handle;
base::LaunchOptions options;
- options.process_handle = &handle;
options.environ = &env;
- if (base::LaunchProcess(argv, options))
+ if (base::LaunchProcess(argv, options, &handle))
ProcessWatcher::EnsureProcessGetsReaped(handle);
}
diff --git a/chrome/browser/printing/printer_manager_dialog_linux.cc b/chrome/browser/printing/printer_manager_dialog_linux.cc
index 02b262c..031d1e9 100644
--- a/chrome/browser/printing/printer_manager_dialog_linux.cc
+++ b/chrome/browser/printing/printer_manager_dialog_linux.cc
@@ -47,10 +47,8 @@
std::vector<std::string> argv;
argv.push_back(command);
- base::LaunchOptions options;
base::ProcessHandle handle;
- options.process_handle = &handle;
- if (!base::LaunchProcess(argv, options)) {
+ if (!base::LaunchProcess(argv, base::LaunchOptions(), &handle)) {
LOG(ERROR) << "Failed to open printer manager dialog ";
return;
}
diff --git a/chrome/browser/process_info_snapshot_mac_unittest.cc b/chrome/browser/process_info_snapshot_mac_unittest.cc
index 226aadc3..0ddbda4 100644
--- a/chrome/browser/process_info_snapshot_mac_unittest.cc
+++ b/chrome/browser/process_info_snapshot_mac_unittest.cc
@@ -113,8 +113,7 @@
base::ProcessHandle process_handle;
base::LaunchOptions options;
options.fds_to_remap = &fds_to_remap;
- options.process_handle = &process_handle;
- ASSERT_TRUE(base::LaunchProcess(argv, options));
+ ASSERT_TRUE(base::LaunchProcess(argv, options, &process_handle));
PCHECK(HANDLE_EINTR(close(fds[1])) == 0);
// Wait until there's some output form top. This is an easy way to tell that
diff --git a/chrome/browser/process_singleton_uitest.cc b/chrome/browser/process_singleton_uitest.cc
index d546b9f3..386d748 100644
--- a/chrome/browser/process_singleton_uitest.cc
+++ b/chrome/browser/process_singleton_uitest.cc
@@ -97,9 +97,7 @@
// Here we don't wait for the app to be terminated because one of the
// process will stay alive while the others will be restarted. If we would
// wait here, we would never get a handle to the main process...
- base::LaunchOptions options;
- options.process_handle = &process_handle_;
- base::LaunchProcess(command_line, options);
+ base::LaunchProcess(command_line, base::LaunchOptions(), &process_handle_);
ASSERT_NE(base::kNullProcessHandle, process_handle_);
// We can wait on the handle here, we should get stuck on one and only
diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc
index 998fcb1..9ee6b9af 100644
--- a/chrome/browser/safe_browsing/safe_browsing_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_test.cc
@@ -149,8 +149,7 @@
#if defined(OS_WIN)
options.start_hidden = true;
#endif
- options.process_handle = &server_handle_;
- if (!base::LaunchProcess(cmd_line, options)) {
+ if (!base::LaunchProcess(cmd_line, options, &server_handle_)) {
LOG(ERROR) << "Failed to launch server: "
<< cmd_line.command_line_string();
return false;
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc
index 831f7e30..71c75f3 100644
--- a/chrome/browser/service/service_process_control.cc
+++ b/chrome/browser/service/service_process_control.cc
@@ -316,7 +316,7 @@
#if defined(OS_WIN)
options.start_hidden = true;
#endif
- if (base::LaunchProcess(*cmd_line_, options)) {
+ if (base::LaunchProcess(*cmd_line_, options, NULL)) {
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this,
&Launcher::DoDetectLaunched));
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 95a304f..cb8b45b9 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -59,9 +59,8 @@
base::ProcessHandle handle;
base::LaunchOptions options;
- options.process_handle = &handle;
options.fds_to_remap = &no_stdin;
- if (!base::LaunchProcess(argv, options)) {
+ if (!base::LaunchProcess(argv, options, &handle)) {
close(devnull);
return false;
}
diff --git a/chrome/browser/ui/webui/options/advanced_options_utils_gtk.cc b/chrome/browser/ui/webui/options/advanced_options_utils_gtk.cc
index 6f267a6e..2f26747 100644
--- a/chrome/browser/ui/webui/options/advanced_options_utils_gtk.cc
+++ b/chrome/browser/ui/webui/options/advanced_options_utils_gtk.cc
@@ -75,9 +75,7 @@
for (size_t i = 0; command[i]; ++i)
argv.push_back(command[i]);
base::ProcessHandle handle;
- base::LaunchOptions options;
- options.process_handle = &handle;
- if (!base::LaunchProcess(argv, options)) {
+ if (!base::LaunchProcess(argv, base::LaunchOptions(), &handle)) {
LOG(ERROR) << "StartProxyConfigUtil failed to start " << command[0];
return false;
}
diff --git a/chrome/common/launchd_mac.mm b/chrome/common/launchd_mac.mm
index f5a5f20..7d28390 100644
--- a/chrome/common/launchd_mac.mm
+++ b/chrome/common/launchd_mac.mm
@@ -132,7 +132,7 @@
base::LaunchOptions options;
options.new_process_group = true;
- return base::LaunchProcess(argv, options);
+ return base::LaunchProcess(argv, options, NULL);
}
CFMutableDictionaryRef Launchd::CreatePlistFromFile(Domain domain,
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index c6abe6f..11d2128 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -803,6 +803,6 @@
CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast,
GetType()));
- base::LaunchProcess(cmd, base::LaunchOptions());
+ base::LaunchProcess(cmd, base::LaunchOptions(), NULL);
}
#endif
diff --git a/chrome/installer/util/product.cc b/chrome/installer/util/product.cc
index 6d3d44d3..eb5286d 100644
--- a/chrome/installer/util/product.cc
+++ b/chrome/installer/util/product.cc
@@ -62,8 +62,7 @@
bool success = !application_path.empty();
if (success) {
CommandLine cmd(application_path.Append(installer::kChromeExe));
- base::LaunchOptions options;
- success = base::LaunchProcess(cmd, options);
+ success = base::LaunchProcess(cmd, base::LaunchOptions(), NULL);
}
return success;
}
diff --git a/chrome/service/cloud_print/cloud_print_proxy.cc b/chrome/service/cloud_print/cloud_print_proxy.cc
index 17e8d352..2e02aa3e 100644
--- a/chrome/service/cloud_print/cloud_print_proxy.cc
+++ b/chrome/service/cloud_print/cloud_print_proxy.cc
@@ -38,8 +38,7 @@
cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir);
cmd_line.AppendSwitch(switches::kNotifyCloudPrintTokenExpired);
- base::LaunchOptions options;
- base::LaunchProcess(cmd_line, options);
+ base::LaunchProcess(cmd_line, base::LaunchOptions(), NULL);
}
CloudPrintProxy::CloudPrintProxy()
diff --git a/chrome/service/service_child_process_host.cc b/chrome/service/service_child_process_host.cc
index 00f96df..d111e90 100644
--- a/chrome/service/service_child_process_host.cc
+++ b/chrome/service/service_child_process_host.cc
@@ -36,9 +36,7 @@
if (no_sandbox) {
base::ProcessHandle process = base::kNullProcessHandle;
cmd_line->AppendSwitch(switches::kNoSandbox);
- base::LaunchOptions options;
- options.process_handle = &process;
- base::LaunchProcess(*cmd_line, options);
+ base::LaunchProcess(*cmd_line, base::LaunchOptions(), &process);
set_handle(process);
} else {
set_handle(sandbox::StartProcessWithAccess(cmd_line, exposed_dir));
diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc
index ad75064e..052e510d 100644
--- a/chrome/test/automation/proxy_launcher.cc
+++ b/chrome/test/automation/proxy_launcher.cc
@@ -442,7 +442,6 @@
base::LaunchOptions options;
options.wait = wait;
- options.process_handle = process;
#if defined(OS_WIN)
options.start_hidden = !state.show_window;
@@ -464,7 +463,7 @@
options.fds_to_remap = &fds;
#endif
- return base::LaunchProcess(command_line, options);
+ return base::LaunchProcess(command_line, options, process);
}
AutomationProxy* ProxyLauncher::automation() const {
diff --git a/chrome/test/layout_test_http_server.cc b/chrome/test/layout_test_http_server.cc
index 34c79ab..b1ad42e 100644
--- a/chrome/test/layout_test_http_server.cc
+++ b/chrome/test/layout_test_http_server.cc
@@ -87,7 +87,7 @@
// continuing.
base::LaunchOptions options;
options.wait = true;
- running_ = base::LaunchProcess(cmd_line, options);
+ running_ = base::LaunchProcess(cmd_line, options, NULL);
return running_;
}
@@ -104,7 +104,7 @@
base::LaunchOptions options;
options.wait = true;
- bool stopped = base::LaunchProcess(cmd_line, options);
+ bool stopped = base::LaunchProcess(cmd_line, options, NULL);
running_ = !stopped;
return stopped;
}
diff --git a/chrome/test/live_sync/live_sync_test.cc b/chrome/test/live_sync/live_sync_test.cc
index 920c89b..a47d67f 100644
--- a/chrome/test/live_sync/live_sync_test.cc
+++ b/chrome/test/live_sync/live_sync_test.cc
@@ -410,8 +410,7 @@
#if defined(OS_WIN)
options.start_hidden = true;
#endif
- options.process_handle = &test_server_handle_;
- if (!base::LaunchProcess(server_cmdline, options))
+ if (!base::LaunchProcess(server_cmdline, options, &test_server_handle_))
LOG(ERROR) << "Could not launch local test server.";
const int kMaxWaitTime = TestTimeouts::live_operation_timeout_ms();
diff --git a/chrome/test/out_of_proc_test_runner.cc b/chrome/test/out_of_proc_test_runner.cc
index 9b230bac..94ff0d5 100644
--- a/chrome/test/out_of_proc_test_runner.cc
+++ b/chrome/test/out_of_proc_test_runner.cc
@@ -354,7 +354,6 @@
base::ProcessHandle process_handle;
base::LaunchOptions options;
- options.process_handle = &process_handle;
#if defined(OS_POSIX)
const char* browser_wrapper = getenv("BROWSER_WRAPPER");
@@ -371,7 +370,7 @@
options.new_process_group = true;
#endif
- if (!base::LaunchProcess(new_cmd_line, options))
+ if (!base::LaunchProcess(new_cmd_line, options, &process_handle))
return false;
int timeout_ms =
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index bc6733d..4031dfb2 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -780,7 +780,7 @@
SetPythonPath();
base::LaunchOptions options;
options.wait = true;
- if (!base::LaunchProcess(*cmd_line.get(), options)) {
+ if (!base::LaunchProcess(*cmd_line.get(), options, NULL)) {
LOG(ERROR) << "Unable to launch websocket server.";
return false;
}
@@ -834,7 +834,7 @@
websocket_pid_file_.value());
base::LaunchOptions options;
options.wait = true;
- base::LaunchProcess(*cmd_line.get(), options);
+ base::LaunchProcess(*cmd_line.get(), options, NULL);
}
TestNotificationObserver::TestNotificationObserver()
diff --git a/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc b/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
index 8e5f1839..7700594 100644
--- a/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
+++ b/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
@@ -62,8 +62,7 @@
if (command_line != NULL) {
base::LaunchOptions options;
options.start_hidden = true;
- options.process_handle = &launched_process;
- base::LaunchProcess(*command_line, options);
+ base::LaunchProcess(*command_line, options, &launched_process);
}
return launched_process;
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc
index 397a07b..240cec21 100644
--- a/chrome_frame/test/chrome_frame_test_utils.cc
+++ b/chrome_frame/test/chrome_frame_test_utils.cc
@@ -159,18 +159,14 @@
LOG(ERROR) << "Failed to find executable: " << executable;
} else {
CommandLine cmdline = CommandLine::FromString(path);
- base::LaunchOptions options;
- options.process_handle = &process;
- if (!base::LaunchProcess(cmdline, options)) {
+ if (!base::LaunchProcess(cmdline, base::LaunchOptions(), &process)) {
LOG(ERROR) << "LaunchProcess failed: " << ::GetLastError();
}
}
} else {
CommandLine cmdline((FilePath(path)));
cmdline.AppendArgNative(argument);
- base::LaunchOptions options;
- options.process_handle = &process;
- if (!base::LaunchProcess(cmdline, options)) {
+ if (!base::LaunchProcess(cmdline, base::LaunchOptions(), &process)) {
LOG(ERROR) << "LaunchProcess failed: " << ::GetLastError();
}
}
@@ -187,9 +183,7 @@
cmd.AppendArgNative(url);
base::ProcessHandle process = NULL;
- base::LaunchOptions options;
- options.process_handle = &process;
- base::LaunchProcess(cmd, options);
+ base::LaunchProcess(cmd, base::LaunchOptions(), &process);
return process;
}
@@ -596,9 +590,8 @@
DVLOG(1) << "Starting crash_service.exe so you know if a test crashes!";
FilePath crash_service_path = exe_dir.AppendASCII("crash_service.exe");
- base::LaunchOptions options;
- options.process_handle = &crash_service;
- if (!base::LaunchProcess(crash_service_path.value(), options)) {
+ if (!base::LaunchProcess(crash_service_path.value(), base::LaunchOptions(),
+ &crash_service)) {
DLOG(ERROR) << "Couldn't start crash_service.exe";
return NULL;
}
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index 4b49369..7bb603f 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -174,8 +174,7 @@
base::LaunchOptions options;
options.environ = &env;
options.fds_to_remap = &fds_to_map;
- options.process_handle = &handle;
- launched = base::LaunchProcess(*cmd_line, options);
+ launched = base::LaunchProcess(*cmd_line, options, &handle);
#if defined(OS_MACOSX)
if (launched)
diff --git a/content/browser/zygote_host_linux.cc b/content/browser/zygote_host_linux.cc
index fb5da590..955628d 100644
--- a/content/browser/zygote_host_linux.cc
+++ b/content/browser/zygote_host_linux.cc
@@ -151,9 +151,8 @@
base::ProcessHandle process = -1;
base::LaunchOptions options;
- options.process_handle = &process;
options.fds_to_remap = &fds_to_map;
- base::LaunchProcess(cmd_line.argv(), options);
+ base::LaunchProcess(cmd_line.argv(), options, &process);
CHECK(process != -1) << "Failed to launch zygote process";
if (using_suid_sandbox_) {
@@ -305,10 +304,10 @@
adj_oom_score_cmdline.push_back(base::IntToString(score));
base::ProcessHandle sandbox_helper_process;
- base::LaunchOptions options;
- options.process_handle = &sandbox_helper_process;
- if (base::LaunchProcess(adj_oom_score_cmdline, options))
+ if (base::LaunchProcess(adj_oom_score_cmdline, base::LaunchOptions(),
+ &sandbox_helper_process)) {
ProcessWatcher::EnsureProcessGetsReaped(sandbox_helper_process);
+ }
} else if (!using_suid_sandbox_) {
if (!base::AdjustOOMScore(pid, score))
PLOG(ERROR) << "Failed to adjust OOM score of renderer with pid " << pid;
diff --git a/content/common/sandbox_policy.cc b/content/common/sandbox_policy.cc
index 2eb189f..dd0473e 100644
--- a/content/common/sandbox_policy.cc
+++ b/content/common/sandbox_policy.cc
@@ -400,9 +400,7 @@
if (!in_sandbox) {
policy->Release();
- base::LaunchOptions options;
- options.process_handle = &process;
- base::LaunchProcess(*cmd_line, options);
+ base::LaunchProcess(*cmd_line, base::LaunchOptions(), &process);
return process;
}
diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc
index b2bf6bb9..d178efba 100644
--- a/media/audio/linux/audio_manager_linux.cc
+++ b/media/audio/linux/audio_manager_linux.cc
@@ -192,8 +192,8 @@
env.get());
std::string command((desktop == base::nix::DESKTOP_ENVIRONMENT_GNOME) ?
"gnome-volume-control" : "kmix");
- base::LaunchOptions options;
- base::LaunchProcess(CommandLine(FilePath(command)), options);
+ base::LaunchProcess(CommandLine(FilePath(command)), base::LaunchOptions(),
+ NULL);
}
void AudioManagerLinux::GetAudioInputDeviceNames(
diff --git a/media/audio/win/audio_manager_win.cc b/media/audio/win/audio_manager_win.cc
index 9a882f8..c361b87d 100644
--- a/media/audio/win/audio_manager_win.cc
+++ b/media/audio/win/audio_manager_win.cc
@@ -250,8 +250,7 @@
path = path.Append(program);
CommandLine command_line(path);
command_line.AppendArg(argument);
- base::LaunchOptions options;
- base::LaunchProcess(command_line, options);
+ base::LaunchProcess(command_line, base::LaunchOptions(), NULL);
}
void AudioManagerWin::GetAudioInputDeviceNames(
diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc
index f9c8b62..0cd8f434 100644
--- a/net/disk_cache/stress_cache.cc
+++ b/net/disk_cache/stress_cache.cc
@@ -59,9 +59,7 @@
cmdline.AppendArg(base::IntToString(iteration));
base::ProcessHandle handle;
- base::LaunchOptions options;
- options.process_handle = &handle;
- if (!base::LaunchProcess(cmdline, options)) {
+ if (!base::LaunchProcess(cmdline, base::LaunchOptions(), &handle)) {
printf("Unable to run test\n");
return kError;
}
diff --git a/net/test/test_server_posix.cc b/net/test/test_server_posix.cc
index a3abc69e..34556948b 100644
--- a/net/test/test_server_posix.cc
+++ b/net/test/test_server_posix.cc
@@ -124,8 +124,7 @@
// Launch a new testserver process.
base::LaunchOptions options;
options.fds_to_remap = &map_write_fd;
- options.process_handle = &process_handle_;
- if (!base::LaunchProcess(python_command, options)) {
+ if (!base::LaunchProcess(python_command, options, &process_handle_)) {
LOG(ERROR) << "Failed to launch " << python_command.command_line_string();
return false;
}
diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc
index 637daae4..f1b4b79 100644
--- a/net/tools/crash_cache/crash_cache.cc
+++ b/net/tools/crash_cache/crash_cache.cc
@@ -49,9 +49,7 @@
cmdline.AppendArg(base::IntToString(action));
base::ProcessHandle handle;
- base::LaunchOptions options;
- options.process_handle = &handle;
- if (!base::LaunchProcess(cmdline, options)) {
+ if (!base::LaunchProcess(cmdline, base::LaunchOptions(), &handle)) {
printf("Unable to run test %d\n", action);
return GENERIC;
}
diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc
index 4a63d00..ee5a50e 100644
--- a/net/tools/dump_cache/dump_cache.cc
+++ b/net/tools/dump_cache/dump_cache.cc
@@ -97,7 +97,7 @@
// TODO(evanm): remove needless usage of wstring from here and elsewhere.
new_command_line.AppendSwitchASCII(kPipe, WideToASCII(pipe_number));
- if (!base::LaunchProcess(new_command_line, base::LaunchOptions())) {
+ if (!base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL)) {
printf("Unable to launch the needed version of this tool: %ls\n",
new_program.c_str());
printf(kUpgradeHelp);