Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Unified Diff: chrome/browser/automation/url_request_automation_job.cc

Issue 8212006: base::Bind: Cleanup in automation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fixes 1. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/url_request_automation_job.cc
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc
index 231b259497956110ffee3942ac8cac61e33fe92c..16dca92602d30b4a85f9d0efb807694bc0d183d1 100644
--- a/chrome/browser/automation/url_request_automation_job.cc
+++ b/chrome/browser/automation/url_request_automation_job.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/automation/url_request_automation_job.h"
+#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/message_loop.h"
#include "base/time.h"
@@ -61,7 +62,7 @@ URLRequestAutomationJob::URLRequestAutomationJob(
redirect_status_(0),
request_id_(request_id),
is_pending_(is_pending),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
DVLOG(1) << "URLRequestAutomationJob create. Count: " << ++instance_count_;
DCHECK(message_filter_ != NULL);
@@ -76,7 +77,7 @@ URLRequestAutomationJob::~URLRequestAutomationJob() {
Cleanup();
}
-bool URLRequestAutomationJob::EnsureProtocolFactoryRegistered() {
+void URLRequestAutomationJob::EnsureProtocolFactoryRegistered() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (!is_protocol_factory_registered_) {
@@ -88,8 +89,6 @@ bool URLRequestAutomationJob::EnsureProtocolFactoryRegistered() {
"https", &URLRequestAutomationJob::Factory);
is_protocol_factory_registered_ = true;
}
-
- return true;
}
net::URLRequestJob* URLRequestAutomationJob::Factory(
@@ -130,8 +129,8 @@ void URLRequestAutomationJob::Start() {
// callbacks happen as they would for network requests.
MessageLoop::current()->PostTask(
FROM_HERE,
- method_factory_.NewRunnableMethod(
- &URLRequestAutomationJob::StartAsync));
+ base::Bind(&URLRequestAutomationJob::StartAsync,
+ weak_factory_.GetWeakPtr()));
} else {
// If this is a pending job, then register it immediately with the message
// filter so it can be serviced later when we receive a request from the
@@ -169,8 +168,8 @@ bool URLRequestAutomationJob::ReadRawData(
} else {
MessageLoop::current()->PostTask(
FROM_HERE,
- method_factory_.NewRunnableMethod(
- &URLRequestAutomationJob::NotifyJobCompletionTask));
+ base::Bind(&URLRequestAutomationJob::NotifyJobCompletionTask,
+ weak_factory_.GetWeakPtr()));
}
return false;
}

Powered by Google App Engine
This is Rietveld 408576698