diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-11 23:28:43 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-11 23:28:43 +0000 |
commit | ca77966c71ba035c1fd9d527acc7c86b684bc929 (patch) | |
tree | 68c6a83fd8cd0631704f5c26d72d5398e5e84b56 /chrome | |
parent | 2c68bf03d6980afc7d6efb33b6468ea74b416378 (diff) | |
download | chromium_src-ca77966c71ba035c1fd9d527acc7c86b684bc929.zip chromium_src-ca77966c71ba035c1fd9d527acc7c86b684bc929.tar.gz chromium_src-ca77966c71ba035c1fd9d527acc7c86b684bc929.tar.bz2 |
Fix DCHECK in ~CrashHandlerHostLinux.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/4655008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65874 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/crash_handler_host_linux.cc | 22 | ||||
-rw-r--r-- | chrome/browser/crash_handler_host_linux.h | 6 |
2 files changed, 22 insertions, 6 deletions
diff --git a/chrome/browser/crash_handler_host_linux.cc b/chrome/browser/crash_handler_host_linux.cc index 4e71017..7c0c11b 100644 --- a/chrome/browser/crash_handler_host_linux.cc +++ b/chrome/browser/crash_handler_host_linux.cc @@ -35,7 +35,10 @@ using google_breakpad::ExceptionHandler; namespace { // Handles the crash dump and frees the allocated BreakpadInfo struct. -void CrashDumpTask(BreakpadInfo* info) { +void CrashDumpTask(CrashHandlerHostLinux* handler, BreakpadInfo* info) { + if (handler->IsShuttingDown()) + return; + HandleCrashDump(*info); delete[] info->filename; delete[] info->process_type; @@ -52,7 +55,8 @@ void CrashDumpTask(BreakpadInfo* info) { // the lifetime of the IO message loop. DISABLE_RUNNABLE_METHOD_REFCOUNT(CrashHandlerHostLinux); -CrashHandlerHostLinux::CrashHandlerHostLinux() { +CrashHandlerHostLinux::CrashHandlerHostLinux() + : shutting_down_(false) { int fds[2]; // We use SOCK_SEQPACKET rather than SOCK_DGRAM to prevent the process from // sending datagrams to other sockets on the system. The sandbox may prevent @@ -77,9 +81,6 @@ CrashHandlerHostLinux::CrashHandlerHostLinux() { CrashHandlerHostLinux::~CrashHandlerHostLinux() { HANDLE_EINTR(close(process_socket_)); HANDLE_EINTR(close(browser_socket_)); - - // If we are quitting and there are crash dumps in the queue, discard them. - uploader_thread_->message_loop()->QuitNow(); } void CrashHandlerHostLinux::Init() { @@ -330,11 +331,20 @@ void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) { uploader_thread_->message_loop()->PostTask( FROM_HERE, - NewRunnableFunction(&CrashDumpTask, info)); + NewRunnableFunction(&CrashDumpTask, this, info)); } void CrashHandlerHostLinux::WillDestroyCurrentMessageLoop() { file_descriptor_watcher_.StopWatchingFileDescriptor(); + + // If we are quitting and there are crash dumps in the queue, turn them into + // no-ops. + shutting_down_ = true; + uploader_thread_->Stop(); +} + +bool CrashHandlerHostLinux::IsShuttingDown() const { + return shutting_down_; } PluginCrashHandlerHostLinux::PluginCrashHandlerHostLinux() { diff --git a/chrome/browser/crash_handler_host_linux.h b/chrome/browser/crash_handler_host_linux.h index 0e7bf6e..bc2214b 100644 --- a/chrome/browser/crash_handler_host_linux.h +++ b/chrome/browser/crash_handler_host_linux.h @@ -42,6 +42,11 @@ class CrashHandlerHostLinux : public MessageLoopForIO::Watcher, // MessageLoop::DestructionObserver impl: virtual void WillDestroyCurrentMessageLoop(); +#if defined(USE_LINUX_BREAKPAD) + // Whether we are shutting down or not. + bool IsShuttingDown() const; +#endif + protected: CrashHandlerHostLinux(); virtual ~CrashHandlerHostLinux(); @@ -67,6 +72,7 @@ class CrashHandlerHostLinux : public MessageLoopForIO::Watcher, #if defined(USE_LINUX_BREAKPAD) MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; scoped_ptr<base::Thread> uploader_thread_; + bool shutting_down_; #endif DISALLOW_COPY_AND_ASSIGN(CrashHandlerHostLinux); |