| 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;
|
| }
|
|
|