Chromium Code Reviews| 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 |