Index: base/process/launch_win.cc |
diff --git a/base/process/launch_win.cc b/base/process/launch_win.cc |
index 1d83ef9e318d5e5e82f7522905af843771871fdc..c2bd295a0147441e708e0255649a5c1341d8d654 100644 |
--- a/base/process/launch_win.cc |
+++ b/base/process/launch_win.cc |
@@ -105,9 +105,13 @@ void RouteStdioToConsole() { |
std::ios::sync_with_stdio(); |
} |
-bool LaunchProcess(const string16& cmdline, |
- const LaunchOptions& options, |
- win::ScopedHandle* process_handle) { |
+Process LaunchProcess(const CommandLine& cmdline, |
+ const LaunchOptions& options) { |
+ return LaunchProcess(cmdline.GetCommandLineString(), options); |
+} |
+ |
+Process LaunchProcess(const string16& cmdline, |
+ const LaunchOptions& options) { |
win::StartupInformation startup_info_wrapper; |
STARTUPINFO* startup_info = startup_info_wrapper.startup_info(); |
@@ -119,18 +123,18 @@ bool LaunchProcess(const string16& cmdline, |
} else { |
if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
DLOG(ERROR) << "Specifying handles to inherit requires Vista or later."; |
- return false; |
+ return Process(); |
} |
if (options.handles_to_inherit->size() > |
std::numeric_limits<DWORD>::max() / sizeof(HANDLE)) { |
DLOG(ERROR) << "Too many handles to inherit."; |
- return false; |
+ return Process(); |
} |
if (!startup_info_wrapper.InitializeProcThreadAttributeList(1)) { |
DPLOG(ERROR); |
- return false; |
+ return Process(); |
} |
if (!startup_info_wrapper.UpdateProcThreadAttribute( |
@@ -139,7 +143,7 @@ bool LaunchProcess(const string16& cmdline, |
static_cast<DWORD>(options.handles_to_inherit->size() * |
sizeof(HANDLE)))) { |
DPLOG(ERROR); |
- return false; |
+ return Process(); |
} |
inherit_handles = true; |
@@ -184,7 +188,7 @@ bool LaunchProcess(const string16& cmdline, |
if (!CreateEnvironmentBlock(&enviroment_block, options.as_user, FALSE)) { |
DPLOG(ERROR); |
- return false; |
+ return Process(); |
} |
BOOL launched = |
@@ -197,7 +201,7 @@ bool LaunchProcess(const string16& cmdline, |
if (!launched) { |
DPLOG(ERROR) << "Command line:" << std::endl << UTF16ToUTF8(cmdline) |
<< std::endl;; |
- return false; |
+ return Process(); |
} |
} else { |
if (!CreateProcess(NULL, |
@@ -206,7 +210,7 @@ bool LaunchProcess(const string16& cmdline, |
startup_info, &temp_process_info)) { |
DPLOG(ERROR) << "Command line:" << std::endl << UTF16ToUTF8(cmdline) |
<< std::endl;; |
- return false; |
+ return Process(); |
} |
} |
base::win::ScopedProcessInformation process_info(temp_process_info); |
@@ -216,7 +220,7 @@ bool LaunchProcess(const string16& cmdline, |
process_info.process_handle())) { |
DLOG(ERROR) << "Could not AssignProcessToObject."; |
KillProcess(process_info.process_handle(), kProcessKilledExitCode, true); |
- return false; |
+ return Process(); |
} |
ResumeThread(process_info.thread_handle()); |
@@ -225,43 +229,7 @@ bool LaunchProcess(const string16& cmdline, |
if (options.wait) |
WaitForSingleObject(process_info.process_handle(), INFINITE); |
- // If the caller wants the process handle, we won't close it. |
- if (process_handle) |
- process_handle->Set(process_info.TakeProcessHandle()); |
- |
- return true; |
-} |
- |
-// TODO(rvargas) crbug.com/416721: Remove this stub after LaunchProcess is |
-// fully migrated to use Process. |
-Process LaunchProcess(const string16& cmdline, |
- const LaunchOptions& options) { |
- win::ScopedHandle process_handle; |
- if (LaunchProcess(cmdline, options, &process_handle)) |
- return Process(process_handle.Take()); |
- |
- return Process(); |
-} |
- |
-bool LaunchProcess(const CommandLine& cmdline, |
- const LaunchOptions& options, |
- ProcessHandle* process_handle) { |
- if (!process_handle) |
- return LaunchProcess(cmdline.GetCommandLineString(), options, NULL); |
- |
- win::ScopedHandle process; |
- bool rv = LaunchProcess(cmdline.GetCommandLineString(), options, &process); |
- *process_handle = process.Take(); |
- return rv; |
-} |
- |
-Process LaunchProcess(const CommandLine& cmdline, |
- const LaunchOptions& options) { |
- ProcessHandle process_handle; |
- if (LaunchProcess(cmdline, options, &process_handle)) |
- return Process(process_handle); |
- |
- return Process(); |
+ return Process(process_info.TakeProcessHandle()); |
} |
Process LaunchElevatedProcess(const CommandLine& cmdline, |