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

Side by Side Diff: base/process_util_win.cc

Issue 7386002: Rename CommandLine::GetCommandLineString(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge. 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
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 "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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 if (options.process_handle) { 262 if (options.process_handle) {
263 *options.process_handle = process_info.hProcess; 263 *options.process_handle = process_info.hProcess;
264 } else { 264 } else {
265 CloseHandle(process_info.hProcess); 265 CloseHandle(process_info.hProcess);
266 } 266 }
267 return true; 267 return true;
268 } 268 }
269 269
270 bool LaunchProcess(const CommandLine& cmdline, 270 bool LaunchProcess(const CommandLine& cmdline,
271 const LaunchOptions& options) { 271 const LaunchOptions& options) {
272 return LaunchProcess(cmdline.command_line_string(), options); 272 return LaunchProcess(cmdline.GetCommandLineString(), options);
273 } 273 }
274 274
275 // Attempts to kill the process identified by the given process 275 // Attempts to kill the process identified by the given process
276 // entry structure, giving it the specified exit code. 276 // entry structure, giving it the specified exit code.
277 // Returns true if this is successful, false otherwise. 277 // Returns true if this is successful, false otherwise.
278 bool KillProcessById(ProcessId process_id, int exit_code, bool wait) { 278 bool KillProcessById(ProcessId process_id, int exit_code, bool wait) {
279 HANDLE process = OpenProcess(PROCESS_TERMINATE | SYNCHRONIZE, 279 HANDLE process = OpenProcess(PROCESS_TERMINATE | SYNCHRONIZE,
280 FALSE, // Don't inherit handle 280 FALSE, // Don't inherit handle
281 process_id); 281 process_id);
282 if (!process) { 282 if (!process) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 start_info.cb = sizeof(STARTUPINFO); 322 start_info.cb = sizeof(STARTUPINFO);
323 start_info.hStdOutput = out_write; 323 start_info.hStdOutput = out_write;
324 // Keep the normal stdin and stderr. 324 // Keep the normal stdin and stderr.
325 start_info.hStdInput = GetStdHandle(STD_INPUT_HANDLE); 325 start_info.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
326 start_info.hStdError = GetStdHandle(STD_ERROR_HANDLE); 326 start_info.hStdError = GetStdHandle(STD_ERROR_HANDLE);
327 start_info.dwFlags |= STARTF_USESTDHANDLES; 327 start_info.dwFlags |= STARTF_USESTDHANDLES;
328 328
329 // Create the child process. 329 // Create the child process.
330 if (!CreateProcess(NULL, 330 if (!CreateProcess(NULL,
331 const_cast<wchar_t*>(cl.command_line_string().c_str()), 331 const_cast<wchar_t*>(cl.GetCommandLineString().c_str()),
332 NULL, NULL, 332 NULL, NULL,
333 TRUE, // Handles are inherited. 333 TRUE, // Handles are inherited.
334 0, NULL, NULL, &start_info, &proc_info)) { 334 0, NULL, NULL, &start_info, &proc_info)) {
335 NOTREACHED() << "Failed to start process"; 335 NOTREACHED() << "Failed to start process";
336 return false; 336 return false;
337 } 337 }
338 338
339 // We don't need the thread handle, close it now. 339 // We don't need the thread handle, close it now.
340 CloseHandle(proc_info.hThread); 340 CloseHandle(proc_info.hThread);
341 341
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 864
865 PERFORMANCE_INFORMATION info; 865 PERFORMANCE_INFORMATION info;
866 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { 866 if (!InternalGetPerformanceInfo(&info, sizeof(info))) {
867 LOG(ERROR) << "Failed to fetch internal performance info."; 867 LOG(ERROR) << "Failed to fetch internal performance info.";
868 return 0; 868 return 0;
869 } 869 }
870 return (info.CommitTotal * system_info.dwPageSize) / 1024; 870 return (info.CommitTotal * system_info.dwPageSize) / 1024;
871 } 871 }
872 872
873 } // namespace base 873 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698