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

Unified Diff: base/process_util_posix.cc

Issue 6794056: Revert 80472 - GTTF: Detect browser crashes on shutdown in UI tests.Previously the automation fra... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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_util.h ('k') | base/process_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_posix.cc
===================================================================
--- base/process_util_posix.cc (revision 80485)
+++ base/process_util_posix.cc (working copy)
@@ -724,15 +724,14 @@
return false;
if (!waitpid_success)
return false;
+ if (!WIFEXITED(status))
+ return false;
if (WIFSIGNALED(status)) {
*exit_code = -1;
return true;
}
- if (WIFEXITED(status)) {
- *exit_code = WEXITSTATUS(status);
- return true;
- }
- return false;
+ *exit_code = WEXITSTATUS(status);
+ return true;
}
#if defined(OS_MACOSX)
@@ -822,6 +821,19 @@
}
}
+bool CrashAwareSleep(ProcessHandle handle, int64 wait_milliseconds) {
+ bool waitpid_success;
+ int status = WaitpidWithTimeout(handle, wait_milliseconds, &waitpid_success);
+ if (status != -1) {
+ DCHECK(waitpid_success);
+ return !(WIFEXITED(status) || WIFSIGNALED(status));
+ } else {
+ // If waitpid returned with an error, then the process doesn't exist
+ // (which most probably means it didn't exist before our call).
+ return waitpid_success;
+ }
+}
+
int64 TimeValToMicroseconds(const struct timeval& tv) {
static const int kMicrosecondsPerSecond = 1000000;
int64 ret = tv.tv_sec; // Avoid (int * int) integer overflow.
« no previous file with comments | « base/process_util.h ('k') | base/process_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698