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

Unified Diff: base/process/process_win.cc

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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/process_posix.cc ('k') | base/synchronization/waitable_event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_win.cc
diff --git a/base/process/process_win.cc b/base/process/process_win.cc
index 8e5360b385603bd64cecf02e663123329a84381d..b62fdb4f8c38f55acb1696097813065dfe735a2c 100644
--- a/base/process/process_win.cc
+++ b/base/process/process_win.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/field_trial.h"
+#include "base/numerics/safe_conversions.h"
#include "base/process/kill.h"
#include "base/win/windows_version.h"
@@ -141,10 +142,17 @@ bool Process::WaitForExit(int* exit_code) {
}
bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) {
- // TODO(rvargas) crbug.com/417532: Move the implementation here.
- if (timeout > TimeDelta::FromMilliseconds(INFINITE))
- timeout = TimeDelta::FromMilliseconds(INFINITE);
- return base::WaitForExitCodeWithTimeout(Handle(), exit_code, timeout);
+ // Limit timeout to INFINITE.
+ DWORD timeout_ms = saturated_cast<DWORD>(timeout.InMilliseconds());
+ if (::WaitForSingleObject(Handle(), timeout_ms) != WAIT_OBJECT_0)
+ return false;
+
+ DWORD temp_code; // Don't clobber out-parameters in case of failure.
+ if (!::GetExitCodeProcess(Handle(), &temp_code))
+ return false;
+
+ *exit_code = temp_code;
+ return true;
}
bool Process::IsProcessBackgrounded() const {
« no previous file with comments | « base/process/process_posix.cc ('k') | base/synchronization/waitable_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698