OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/process_util.h" | 5 #include "base/process_util.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <io.h> | 8 #include <io.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #include <userenv.h> | 10 #include <userenv.h> |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 bool LaunchProcess(const string16& cmdline, | 286 bool LaunchProcess(const string16& cmdline, |
287 const LaunchOptions& options, | 287 const LaunchOptions& options, |
288 ProcessHandle* process_handle) { | 288 ProcessHandle* process_handle) { |
289 STARTUPINFO startup_info = {}; | 289 STARTUPINFO startup_info = {}; |
290 startup_info.cb = sizeof(startup_info); | 290 startup_info.cb = sizeof(startup_info); |
291 if (options.empty_desktop_name) | 291 if (options.empty_desktop_name) |
292 startup_info.lpDesktop = L""; | 292 startup_info.lpDesktop = L""; |
293 startup_info.dwFlags = STARTF_USESHOWWINDOW; | 293 startup_info.dwFlags = STARTF_USESHOWWINDOW; |
294 startup_info.wShowWindow = options.start_hidden ? SW_HIDE : SW_SHOW; | 294 startup_info.wShowWindow = options.start_hidden ? SW_HIDE : SW_SHOW; |
295 | 295 |
| 296 if (options.stdin_handle || options.stdout_handle || options.stderr_handle) { |
| 297 DCHECK(options.inherit_handles); |
| 298 DCHECK(options.stdin_handle); |
| 299 DCHECK(options.stdout_handle); |
| 300 DCHECK(options.stderr_handle); |
| 301 startup_info.dwFlags |= STARTF_USESTDHANDLES; |
| 302 startup_info.hStdInput = options.stdin_handle; |
| 303 startup_info.hStdOutput = options.stdout_handle; |
| 304 startup_info.hStdError = options.stderr_handle; |
| 305 } |
| 306 |
296 DWORD flags = 0; | 307 DWORD flags = 0; |
297 | 308 |
298 if (options.job_handle) { | 309 if (options.job_handle) { |
299 flags |= CREATE_SUSPENDED; | 310 flags |= CREATE_SUSPENDED; |
300 | 311 |
301 // If this code is run under a debugger, the launched process is | 312 // If this code is run under a debugger, the launched process is |
302 // automatically associated with a job object created by the debugger. | 313 // automatically associated with a job object created by the debugger. |
303 // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this. | 314 // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this. |
304 flags |= CREATE_BREAKAWAY_FROM_JOB; | 315 flags |= CREATE_BREAKAWAY_FROM_JOB; |
305 } | 316 } |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 | 984 |
974 PERFORMANCE_INFORMATION info; | 985 PERFORMANCE_INFORMATION info; |
975 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { | 986 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { |
976 DLOG(ERROR) << "Failed to fetch internal performance info."; | 987 DLOG(ERROR) << "Failed to fetch internal performance info."; |
977 return 0; | 988 return 0; |
978 } | 989 } |
979 return (info.CommitTotal * system_info.dwPageSize) / 1024; | 990 return (info.CommitTotal * system_info.dwPageSize) / 1024; |
980 } | 991 } |
981 | 992 |
982 } // namespace base | 993 } // namespace base |
OLD | NEW |