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

Unified Diff: chrome/browser/browser_main_posix.cc

Issue 6943001: Add shutdown trace functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_main_posix.cc
diff --git a/chrome/browser/browser_main_posix.cc b/chrome/browser/browser_main_posix.cc
index 9729f64522e50b5ea8e0c216e5a569504719d140..7b3682a1bf540dedba3ff5ffe7ac41ddee2c8595 100644
--- a/chrome/browser/browser_main_posix.cc
+++ b/chrome/browser/browser_main_posix.cc
@@ -89,6 +89,23 @@ ShutdownDetector::ShutdownDetector(int shutdown_fd)
CHECK_NE(shutdown_fd_, -1);
}
+
+// These functions are used to help us diagnose crash dumps that happen
+// during the shutdown process.
+#define NOINLINE __attribute__((noinline))
+
+NOINLINE void ShutdownFDReadError() {
+ sleep(UINT_MAX);
willchan no longer on Chromium 2011/05/04 21:06:49 I think you need <limits.h> for this constant and
DaveMoore 2011/05/09 17:41:42 Done. I kept the sleep() call, added the asm("") a
+}
+
+NOINLINE void ShutdownFDClosedError() {
+ sleep(UINT_MAX);
+}
+
+NOINLINE void CloseAllBrowsersAndExitPosted() {
+ sleep(UINT_MAX);
+}
+
void ShutdownDetector::ThreadMain() {
base::PlatformThread::SetName("CrShutdownDetector");
@@ -102,9 +119,11 @@ void ShutdownDetector::ThreadMain() {
sizeof(signal) - bytes_read));
if (ret < 0) {
NOTREACHED() << "Unexpected error: " << strerror(errno);
+ ShutdownFDReadError();
break;
} else if (ret == 0) {
NOTREACHED() << "Unexpected closure of shutdown pipe.";
+ ShutdownFDClosedError();
break;
}
bytes_read += ret;
@@ -134,6 +153,7 @@ void ShutdownDetector::ThreadMain() {
RAW_LOG(WARNING, "Still here, exiting really ungracefully.");
_exit(signal | (1 << 7));
}
+ CloseAllBrowsersAndExitPosted();
}
// Sets the file descriptor soft limit to |max_descriptors| or the OS hard
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698