Index: content/browser/net/url_request_slow_download_job.cc |
diff --git a/content/browser/net/url_request_slow_download_job.cc b/content/browser/net/url_request_slow_download_job.cc |
index 562bb06a44929519db9165d78bf9a040f96e0e5b..74200f3d5e840ba50002847e7ba57a49f1492cf0 100644 |
--- a/content/browser/net/url_request_slow_download_job.cc |
+++ b/content/browser/net/url_request_slow_download_job.cc |
@@ -4,6 +4,7 @@ |
#include "content/browser/net/url_request_slow_download_job.h" |
+#include "base/bind.h" |
#include "base/compiler_specific.h" |
#include "base/logging.h" |
#include "base/message_loop.h" |
@@ -37,8 +38,8 @@ base::LazyInstance< |
void URLRequestSlowDownloadJob::Start() { |
MessageLoop::current()->PostTask( |
FROM_HERE, |
- method_factory_.NewRunnableMethod( |
- &URLRequestSlowDownloadJob::StartAsync)); |
+ base::Bind(&URLRequestSlowDownloadJob::StartAsync, |
+ weak_factory_.GetWeakPtr())); |
} |
// static |
@@ -84,7 +85,7 @@ URLRequestSlowDownloadJob::URLRequestSlowDownloadJob(net::URLRequest* request) |
first_download_size_remaining_(kFirstDownloadSize), |
should_finish_download_(false), |
buffer_size_(0), |
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
} |
void URLRequestSlowDownloadJob::StartAsync() { |
@@ -126,8 +127,8 @@ bool URLRequestSlowDownloadJob::ReadRawData(net::IOBuffer* buf, int buf_size, |
SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0)); |
MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
- method_factory_.NewRunnableMethod( |
- &URLRequestSlowDownloadJob::CheckDoneStatus), |
+ base::Bind(&URLRequestSlowDownloadJob::CheckDoneStatus, |
+ weak_factory_.GetWeakPtr()), |
100); |
// Return false to signal there is pending data. |
@@ -147,8 +148,8 @@ void URLRequestSlowDownloadJob::CheckDoneStatus() { |
} else { |
MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
- method_factory_.NewRunnableMethod( |
- &URLRequestSlowDownloadJob::CheckDoneStatus), |
+ base::Bind(&URLRequestSlowDownloadJob::CheckDoneStatus, |
+ weak_factory_.GetWeakPtr()), |
100); |
} |
} |