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

Unified Diff: base/process_util_win.cc

Issue 10808069: Remove old test timeout and process waiting function interfaces. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove old test timeout and wait for process interfaces. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process_util_posix.cc ('k') | base/test/test_timeouts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_win.cc
diff --git a/base/process_util_win.cc b/base/process_util_win.cc
index 55d2959c10813a6297e5b9e73418eb85e6d42389..f53e5b4079a4120dbfd1d3650e50d4e3979ac5f4 100644
--- a/base/process_util_win.cc
+++ b/base/process_util_win.cc
@@ -546,8 +546,8 @@ bool WaitForExitCode(ProcessHandle handle, int* exit_code) {
}
bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code,
- int64 timeout_milliseconds) {
- if (::WaitForSingleObject(handle, timeout_milliseconds) != WAIT_OBJECT_0)
+ base::TimeDelta timeout) {
+ if (::WaitForSingleObject(handle, timeout.InMilliseconds()) != WAIT_OBJECT_0)
return false;
DWORD temp_code; // Don't clobber out-parameters in case of failure.
if (!::GetExitCodeProcess(handle, &temp_code))
@@ -557,12 +557,6 @@ bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code,
return true;
}
-bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code,
- base::TimeDelta timeout) {
- return WaitForExitCodeWithTimeout(
- handle, exit_code, timeout.InMilliseconds());
-}
-
ProcessIterator::ProcessIterator(const ProcessFilter* filter)
: started_iteration_(false),
filter_(filter) {
@@ -620,12 +614,24 @@ bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
base::TimeDelta wait,
const ProcessFilter* filter) {
- return WaitForProcessesToExit(executable_name, wait.InMilliseconds(), filter);
-}
+ const ProcessEntry* entry;
+ bool result = true;
+ DWORD start_time = GetTickCount();
-bool WaitForSingleProcess(ProcessHandle handle, int64 wait_milliseconds) {
- return WaitForSingleProcess(
- handle, base::TimeDelta::FromMilliseconds(wait_milliseconds));
+ NamedProcessIterator iter(executable_name, filter);
+ while ((entry = iter.NextProcessEntry())) {
+ DWORD remaining_wait =
+ std::max<int64>(0,
jar (doing other things) 2012/07/25 19:03:19 nit: Don't bother to wrap line 623 given that you'
+ wait.InMilliseconds() - (GetTickCount() - start_time));
+ HANDLE process = OpenProcess(SYNCHRONIZE,
+ FALSE,
+ entry->th32ProcessID);
+ DWORD wait_result = WaitForSingleObject(process, remaining_wait);
+ CloseHandle(process);
+ result = result && (wait_result == WAIT_OBJECT_0);
+ }
+
+ return result;
}
bool WaitForSingleProcess(ProcessHandle handle, base::TimeDelta wait) {
« no previous file with comments | « base/process_util_posix.cc ('k') | base/test/test_timeouts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698