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

Side by Side Diff: base/process_util_win.cc

Issue 10821062: Fix CleanupProcesses() interface to use TimeDelta. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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_posix.cc ('k') | chrome/installer/setup/uninstall.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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 } 612 }
613 613
614 bool WaitForSingleProcess(ProcessHandle handle, base::TimeDelta wait) { 614 bool WaitForSingleProcess(ProcessHandle handle, base::TimeDelta wait) {
615 int exit_code; 615 int exit_code;
616 if (!WaitForExitCodeWithTimeout(handle, &exit_code, wait)) 616 if (!WaitForExitCodeWithTimeout(handle, &exit_code, wait))
617 return false; 617 return false;
618 return exit_code == 0; 618 return exit_code == 0;
619 } 619 }
620 620
621 bool CleanupProcesses(const FilePath::StringType& executable_name, 621 bool CleanupProcesses(const FilePath::StringType& executable_name,
622 int64 wait_milliseconds, 622 base::TimeDelta wait,
623 int exit_code, 623 int exit_code,
624 const ProcessFilter* filter) { 624 const ProcessFilter* filter) {
625 bool exited_cleanly = WaitForProcessesToExit( 625 bool exited_cleanly = WaitForProcessesToExit(executable_name, wait, filter);
626 executable_name,
627 base::TimeDelta::FromMilliseconds(wait_milliseconds),
628 filter);
629 if (!exited_cleanly) 626 if (!exited_cleanly)
630 KillProcesses(executable_name, exit_code, filter); 627 KillProcesses(executable_name, exit_code, filter);
631 return exited_cleanly; 628 return exited_cleanly;
632 } 629 }
633 630
634 void EnsureProcessTerminated(ProcessHandle process) { 631 void EnsureProcessTerminated(ProcessHandle process) {
635 DCHECK(process != GetCurrentProcess()); 632 DCHECK(process != GetCurrentProcess());
636 633
637 // If already signaled, then we are done! 634 // If already signaled, then we are done!
638 if (WaitForSingleObject(process, 0) == WAIT_OBJECT_0) { 635 if (WaitForSingleObject(process, 0) == WAIT_OBJECT_0) {
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 995
999 PERFORMANCE_INFORMATION info; 996 PERFORMANCE_INFORMATION info;
1000 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { 997 if (!InternalGetPerformanceInfo(&info, sizeof(info))) {
1001 DLOG(ERROR) << "Failed to fetch internal performance info."; 998 DLOG(ERROR) << "Failed to fetch internal performance info.";
1002 return 0; 999 return 0;
1003 } 1000 }
1004 return (info.CommitTotal * system_info.dwPageSize) / 1024; 1001 return (info.CommitTotal * system_info.dwPageSize) / 1024;
1005 } 1002 }
1006 1003
1007 } // namespace base 1004 } // namespace base
OLDNEW
« no previous file with comments | « base/process_util_posix.cc ('k') | chrome/installer/setup/uninstall.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698