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 @@
#include <sys/syscall.h>
#include <unistd.h>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/eintr_wrapper.h"
#include "base/file_path.h"
#include "base/format_macros.h"
......@@ -21,7 +23,6 @@
#include "base/rand_util.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/task.h"
#include "base/threading/thread.h"
#include "breakpad/src/client/linux/handler/exception_handler.h"
#include "breakpad/src/client/linux/minidump_writer/linux_dumper.h"
......@@ -60,8 +61,8 @@ void CrashDumpTask(CrashHandlerHostLinux* handler, BreakpadInfo* info) {
// Since classes derived from CrashHandlerHostLinux are singletons, it's only
// destroyed at the end of the processes lifetime, which is greater in span than
// the lifetime of the IO message loop.
DISABLE_RUNNABLE_METHOD_REFCOUNT(CrashHandlerHostLinux);
// the lifetime of the IO message loop. Thus, all calls to base::Bind() use
// non-refcounted pointers.
CrashHandlerHostLinux::CrashHandlerHostLinux()
: shutting_down_(false) {
......@@ -83,7 +84,7 @@ CrashHandlerHostLinux::CrashHandlerHostLinux()
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this, &CrashHandlerHostLinux::Init));
base::Bind(&CrashHandlerHostLinux::Init, base::Unretained(this)));
}
CrashHandlerHostLinux::~CrashHandlerHostLinux() {
......@@ -317,12 +318,12 @@ void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) {
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(this,
&CrashHandlerHostLinux::WriteDumpFile,
info,
crashing_pid,
crash_context,
signal_fd));
base::Bind(&CrashHandlerHostLinux::WriteDumpFile,
base::Unretained(this),
info,
crashing_pid,
crash_context,
signal_fd));
}
void CrashHandlerHostLinux::WriteDumpFile(BreakpadInfo* info,
......@@ -356,10 +357,10 @@ void CrashHandlerHostLinux::WriteDumpFile(BreakpadInfo* info,
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this,
&CrashHandlerHostLinux::QueueCrashDumpTask,
info,
signal_fd));
base::Bind(&CrashHandlerHostLinux::QueueCrashDumpTask,
base::Unretained(this),
info,
signal_fd));
}
void CrashHandlerHostLinux::QueueCrashDumpTask(BreakpadInfo* info,
......@@ -379,7 +380,7 @@ void CrashHandlerHostLinux::QueueCrashDumpTask(BreakpadInfo* info,
uploader_thread_->message_loop()->PostTask(
FROM_HERE,
NewRunnableFunction(&CrashDumpTask, this, info));
base::Bind(&CrashDumpTask, base::Unretained(this), info));
}
void CrashHandlerHostLinux::WillDestroyCurrentMessageLoop() {
......
......@@ -6,6 +6,7 @@
#include <iterator>
#include "base/bind.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
......@@ -38,9 +39,11 @@ CrashUploadList::CrashUploadList(Delegate* delegate) : delegate_(delegate) {}
CrashUploadList::~CrashUploadList() {}
void CrashUploadList::LoadCrashListAsynchronously() {
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(this,
&CrashUploadList::LoadCrashListAndInformDelegateOfCompletion));
BrowserThread::PostTask(
BrowserThread::FILE,
FROM_HERE,
base::Bind(&CrashUploadList::LoadCrashListAndInformDelegateOfCompletion,
this));
}
void CrashUploadList::ClearDelegate() {
......@@ -50,8 +53,10 @@ void CrashUploadList::ClearDelegate() {
void CrashUploadList::LoadCrashListAndInformDelegateOfCompletion() {
LoadCrashList();
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this, &CrashUploadList::InformDelegateOfCompletion));
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&CrashUploadList::InformDelegateOfCompletion, this));
}
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