Commit 69eb9112 authored by dcheng@chromium.org's avatar dcheng@chromium.org

base::Bind() conversion for crash handler/uploader.

BUG=none
TEST=trybots


Review URL: http://codereview.chromium.org/8536055

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111223 0039d316-1c4b-4281-b951-d872f2087c98
parent 8d0c7600
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <sys/syscall.h> #include <sys/syscall.h>
#include <unistd.h> #include <unistd.h>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/eintr_wrapper.h" #include "base/eintr_wrapper.h"
#include "base/file_path.h" #include "base/file_path.h"
#include "base/format_macros.h" #include "base/format_macros.h"
...@@ -21,7 +23,6 @@ ...@@ -21,7 +23,6 @@
#include "base/rand_util.h" #include "base/rand_util.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "base/stringprintf.h" #include "base/stringprintf.h"
#include "base/task.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "breakpad/src/client/linux/handler/exception_handler.h" #include "breakpad/src/client/linux/handler/exception_handler.h"
#include "breakpad/src/client/linux/minidump_writer/linux_dumper.h" #include "breakpad/src/client/linux/minidump_writer/linux_dumper.h"
...@@ -60,8 +61,8 @@ void CrashDumpTask(CrashHandlerHostLinux* handler, BreakpadInfo* info) { ...@@ -60,8 +61,8 @@ void CrashDumpTask(CrashHandlerHostLinux* handler, BreakpadInfo* info) {
// Since classes derived from CrashHandlerHostLinux are singletons, it's only // Since classes derived from CrashHandlerHostLinux are singletons, it's only
// destroyed at the end of the processes lifetime, which is greater in span than // destroyed at the end of the processes lifetime, which is greater in span than
// the lifetime of the IO message loop. // the lifetime of the IO message loop. Thus, all calls to base::Bind() use
DISABLE_RUNNABLE_METHOD_REFCOUNT(CrashHandlerHostLinux); // non-refcounted pointers.
CrashHandlerHostLinux::CrashHandlerHostLinux() CrashHandlerHostLinux::CrashHandlerHostLinux()
: shutting_down_(false) { : shutting_down_(false) {
...@@ -83,7 +84,7 @@ CrashHandlerHostLinux::CrashHandlerHostLinux() ...@@ -83,7 +84,7 @@ CrashHandlerHostLinux::CrashHandlerHostLinux()
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE, BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this, &CrashHandlerHostLinux::Init)); base::Bind(&CrashHandlerHostLinux::Init, base::Unretained(this)));
} }
CrashHandlerHostLinux::~CrashHandlerHostLinux() { CrashHandlerHostLinux::~CrashHandlerHostLinux() {
...@@ -317,12 +318,12 @@ void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) { ...@@ -317,12 +318,12 @@ void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) {
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE, BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(this, base::Bind(&CrashHandlerHostLinux::WriteDumpFile,
&CrashHandlerHostLinux::WriteDumpFile, base::Unretained(this),
info, info,
crashing_pid, crashing_pid,
crash_context, crash_context,
signal_fd)); signal_fd));
} }
void CrashHandlerHostLinux::WriteDumpFile(BreakpadInfo* info, void CrashHandlerHostLinux::WriteDumpFile(BreakpadInfo* info,
...@@ -356,10 +357,10 @@ void CrashHandlerHostLinux::WriteDumpFile(BreakpadInfo* info, ...@@ -356,10 +357,10 @@ void CrashHandlerHostLinux::WriteDumpFile(BreakpadInfo* info,
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE, BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this, base::Bind(&CrashHandlerHostLinux::QueueCrashDumpTask,
&CrashHandlerHostLinux::QueueCrashDumpTask, base::Unretained(this),
info, info,
signal_fd)); signal_fd));
} }
void CrashHandlerHostLinux::QueueCrashDumpTask(BreakpadInfo* info, void CrashHandlerHostLinux::QueueCrashDumpTask(BreakpadInfo* info,
...@@ -379,7 +380,7 @@ void CrashHandlerHostLinux::QueueCrashDumpTask(BreakpadInfo* info, ...@@ -379,7 +380,7 @@ void CrashHandlerHostLinux::QueueCrashDumpTask(BreakpadInfo* info,
uploader_thread_->message_loop()->PostTask( uploader_thread_->message_loop()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableFunction(&CrashDumpTask, this, info)); base::Bind(&CrashDumpTask, base::Unretained(this), info));
} }
void CrashHandlerHostLinux::WillDestroyCurrentMessageLoop() { void CrashHandlerHostLinux::WillDestroyCurrentMessageLoop() {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <iterator> #include <iterator>
#include "base/bind.h"
#include "base/file_path.h" #include "base/file_path.h"
#include "base/file_util.h" #include "base/file_util.h"
#include "base/path_service.h" #include "base/path_service.h"
...@@ -38,9 +39,11 @@ CrashUploadList::CrashUploadList(Delegate* delegate) : delegate_(delegate) {} ...@@ -38,9 +39,11 @@ CrashUploadList::CrashUploadList(Delegate* delegate) : delegate_(delegate) {}
CrashUploadList::~CrashUploadList() {} CrashUploadList::~CrashUploadList() {}
void CrashUploadList::LoadCrashListAsynchronously() { void CrashUploadList::LoadCrashListAsynchronously() {
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, BrowserThread::PostTask(
NewRunnableMethod(this, BrowserThread::FILE,
&CrashUploadList::LoadCrashListAndInformDelegateOfCompletion)); FROM_HERE,
base::Bind(&CrashUploadList::LoadCrashListAndInformDelegateOfCompletion,
this));
} }
void CrashUploadList::ClearDelegate() { void CrashUploadList::ClearDelegate() {
...@@ -50,8 +53,10 @@ void CrashUploadList::ClearDelegate() { ...@@ -50,8 +53,10 @@ void CrashUploadList::ClearDelegate() {
void CrashUploadList::LoadCrashListAndInformDelegateOfCompletion() { void CrashUploadList::LoadCrashListAndInformDelegateOfCompletion() {
LoadCrashList(); LoadCrashList();
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, BrowserThread::PostTask(
NewRunnableMethod(this, &CrashUploadList::InformDelegateOfCompletion)); BrowserThread::UI,
FROM_HERE,
base::Bind(&CrashUploadList::InformDelegateOfCompletion, this));
} }
void CrashUploadList::LoadCrashList() { void CrashUploadList::LoadCrashList() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment