summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-12 07:27:50 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-12 07:27:50 +0000
commit34fadad9cca3303423ae114c71ca421f889e3259 (patch)
tree9dbd6ad457fb0ff00ec60214e65b25b9c56bc4eb
parentfa8141b95a155385e6d162c21972e1743188e799 (diff)
downloadchromium_src-34fadad9cca3303423ae114c71ca421f889e3259.zip
chromium_src-34fadad9cca3303423ae114c71ca421f889e3259.tar.gz
chromium_src-34fadad9cca3303423ae114c71ca421f889e3259.tar.bz2
Use SequencedWorkerPool instead of FILE thread to dump file
BUG=284601 Review URL: https://codereview.chromium.org/26515006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228328 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/crash_handler_host_linux.cc11
-rw-r--r--chrome/browser/crash_handler_host_linux.h5
2 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/crash_handler_host_linux.cc b/chrome/browser/crash_handler_host_linux.cc
index b6cfeeb..41b0f55 100644
--- a/chrome/browser/crash_handler_host_linux.cc
+++ b/chrome/browser/crash_handler_host_linux.cc
@@ -70,7 +70,8 @@ void CrashDumpTask(CrashHandlerHostLinux* handler, BreakpadInfo* info) {
// non-refcounted pointers.
CrashHandlerHostLinux::CrashHandlerHostLinux()
- : shutting_down_(false) {
+ : shutting_down_(false),
+ worker_pool_token_(BrowserThread::GetBlockingPool()->GetSequenceToken()) {
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
@@ -341,8 +342,9 @@ void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) {
info->process_start_time = uptime;
info->oom_size = oom_size;
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
+ BrowserThread::GetBlockingPool()->PostSequencedWorkerTask(
+ worker_pool_token_,
+ FROM_HERE,
base::Bind(&CrashHandlerHostLinux::WriteDumpFile,
base::Unretained(this),
info,
@@ -355,7 +357,8 @@ void CrashHandlerHostLinux::WriteDumpFile(BreakpadInfo* info,
pid_t crashing_pid,
char* crash_context,
int signal_fd) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread(
+ worker_pool_token_));
base::FilePath dumps_path("/tmp");
PathService::Get(base::DIR_TEMP, &dumps_path);
diff --git a/chrome/browser/crash_handler_host_linux.h b/chrome/browser/crash_handler_host_linux.h
index 345c693..6b27037 100644
--- a/chrome/browser/crash_handler_host_linux.h
+++ b/chrome/browser/crash_handler_host_linux.h
@@ -12,6 +12,7 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/threading/sequenced_worker_pool.h"
struct BreakpadInfo;
@@ -81,6 +82,10 @@ class CrashHandlerHostLinux : public base::MessageLoopForIO::Watcher,
scoped_ptr<base::Thread> uploader_thread_;
bool shutting_down_;
+ // Unique sequence token so that writing crash dump won't be blocked
+ // by other tasks.
+ base::SequencedWorkerPool::SequenceToken worker_pool_token_;
+
#if defined(ADDRESS_SANITIZER)
char* asan_report_str_;
#endif