summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_request_test_job.cc
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-20 21:12:34 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-20 21:12:34 +0000
commit098b2911b28bbfabde8fe38cfa45f2d6c94e2c6e (patch)
treef575dc5d46a3527bcacba05db679415be0ae47c8 /net/url_request/url_request_test_job.cc
parenta6a408717b680f1201b2f8a30cb928a65c7d08b2 (diff)
downloadchromium_src-098b2911b28bbfabde8fe38cfa45f2d6c94e2c6e.zip
chromium_src-098b2911b28bbfabde8fe38cfa45f2d6c94e2c6e.tar.gz
chromium_src-098b2911b28bbfabde8fe38cfa45f2d6c94e2c6e.tar.bz2
Convert NewRunnableMethod() calls to base::Bind().
BUG=none TEST=existing tests. Review URL: http://codereview.chromium.org/8956017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115181 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request/url_request_test_job.cc')
-rw-r--r--net/url_request/url_request_test_job.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc
index 6668b03..2c8efa6 100644
--- a/net/url_request/url_request_test_job.cc
+++ b/net/url_request/url_request_test_job.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include <list>
+#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/lazy_instance.h"
#include "base/message_loop.h"
@@ -91,7 +92,7 @@ URLRequestTestJob::URLRequestTestJob(URLRequest* request)
offset_(0),
async_buf_(NULL),
async_buf_size_(0),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
}
URLRequestTestJob::URLRequestTestJob(URLRequest* request,
@@ -102,7 +103,7 @@ URLRequestTestJob::URLRequestTestJob(URLRequest* request,
offset_(0),
async_buf_(NULL),
async_buf_size_(0),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
}
URLRequestTestJob::URLRequestTestJob(URLRequest* request,
@@ -117,7 +118,7 @@ URLRequestTestJob::URLRequestTestJob(URLRequest* request,
offset_(0),
async_buf_(NULL),
async_buf_size_(0),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
}
URLRequestTestJob::~URLRequestTestJob() {
@@ -138,8 +139,8 @@ void URLRequestTestJob::Start() {
// Start reading asynchronously so that all error reporting and data
// callbacks happen as they would for network requests.
MessageLoop::current()->PostTask(
- FROM_HERE, method_factory_.NewRunnableMethod(
- &URLRequestTestJob::StartAsync));
+ FROM_HERE, base::Bind(&URLRequestTestJob::StartAsync,
+ weak_factory_.GetWeakPtr()));
}
void URLRequestTestJob::StartAsync() {
@@ -227,7 +228,7 @@ bool URLRequestTestJob::IsRedirectResponse(GURL* location,
void URLRequestTestJob::Kill() {
stage_ = DONE;
URLRequestJob::Kill();
- method_factory_.RevokeAll();
+ weak_factory_.InvalidateWeakPtrs();
g_pending_jobs.Get().erase(
std::remove(
g_pending_jobs.Get().begin(), g_pending_jobs.Get().end(), this),
@@ -268,8 +269,8 @@ void URLRequestTestJob::ProcessNextOperation() {
void URLRequestTestJob::AdvanceJob() {
if (auto_advance_) {
MessageLoop::current()->PostTask(
- FROM_HERE, method_factory_.NewRunnableMethod(
- &URLRequestTestJob::ProcessNextOperation));
+ FROM_HERE, base::Bind(&URLRequestTestJob::ProcessNextOperation,
+ weak_factory_.GetWeakPtr()));
return;
}
g_pending_jobs.Get().push_back(this);