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

Side by Side Diff: base/process_util_win.cc

Issue 10694131: Switch to TimeDelta interface for process waiting functions in base. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
« no previous file with comments | « base/process_util_unittest.cc ('k') | base/threading/worker_pool_unittest.cc » ('j') | 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) 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 case kDebuggerTerminatedExitCode: // Debugger terminated process. 532 case kDebuggerTerminatedExitCode: // Debugger terminated process.
533 case kProcessKilledExitCode: // Task manager kill. 533 case kProcessKilledExitCode: // Task manager kill.
534 return TERMINATION_STATUS_PROCESS_WAS_KILLED; 534 return TERMINATION_STATUS_PROCESS_WAS_KILLED;
535 default: 535 default:
536 // All other exit codes indicate crashes. 536 // All other exit codes indicate crashes.
537 return TERMINATION_STATUS_PROCESS_CRASHED; 537 return TERMINATION_STATUS_PROCESS_CRASHED;
538 } 538 }
539 } 539 }
540 540
541 bool WaitForExitCode(ProcessHandle handle, int* exit_code) { 541 bool WaitForExitCode(ProcessHandle handle, int* exit_code) {
542 bool success = WaitForExitCodeWithTimeout(handle, exit_code, INFINITE); 542 bool success = WaitForExitCodeWithTimeout(
543 handle, exit_code, base::TimeDelta::FromMilliseconds(INFINITE));
543 CloseProcessHandle(handle); 544 CloseProcessHandle(handle);
544 return success; 545 return success;
545 } 546 }
546 547
547 bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code, 548 bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code,
548 int64 timeout_milliseconds) { 549 int64 timeout_milliseconds) {
549 if (::WaitForSingleObject(handle, timeout_milliseconds) != WAIT_OBJECT_0) 550 if (::WaitForSingleObject(handle, timeout_milliseconds) != WAIT_OBJECT_0)
550 return false; 551 return false;
551 DWORD temp_code; // Don't clobber out-parameters in case of failure. 552 DWORD temp_code; // Don't clobber out-parameters in case of failure.
552 if (!::GetExitCodeProcess(handle, &temp_code)) 553 if (!::GetExitCodeProcess(handle, &temp_code))
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1014
1014 PERFORMANCE_INFORMATION info; 1015 PERFORMANCE_INFORMATION info;
1015 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { 1016 if (!InternalGetPerformanceInfo(&info, sizeof(info))) {
1016 DLOG(ERROR) << "Failed to fetch internal performance info."; 1017 DLOG(ERROR) << "Failed to fetch internal performance info.";
1017 return 0; 1018 return 0;
1018 } 1019 }
1019 return (info.CommitTotal * system_info.dwPageSize) / 1024; 1020 return (info.CommitTotal * system_info.dwPageSize) / 1024;
1020 } 1021 }
1021 1022
1022 } // namespace base 1023 } // namespace base
OLDNEW
« no previous file with comments | « base/process_util_unittest.cc ('k') | base/threading/worker_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698