diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 20:15:38 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 20:15:38 +0000 |
commit | 83fdc3d23441c8b418ef3cdfc737d2cfa8dbff53 (patch) | |
tree | ed3ccc80a2aecfcbf7aa8b1fa972515e00d6a7cc /net/url_request/url_request_ftp_job.cc | |
parent | 66e2687289aa4b5f1a1ce61c776a1ffc6497325e (diff) | |
download | chromium_src-83fdc3d23441c8b418ef3cdfc737d2cfa8dbff53.zip chromium_src-83fdc3d23441c8b418ef3cdfc737d2cfa8dbff53.tar.gz chromium_src-83fdc3d23441c8b418ef3cdfc737d2cfa8dbff53.tar.bz2 |
Stop adding more refcounts to some more URLRequestJob subtypes.
Switch to using ScopedRunnableMethodFactory::NewRunnableMethod().
BUG=63692
TEST=existing
Review URL: http://codereview.chromium.org/5532005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68204 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request/url_request_ftp_job.cc')
-rw-r--r-- | net/url_request/url_request_ftp_job.cc | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc index c60275b..c6d8ff1 100644 --- a/net/url_request/url_request_ftp_job.cc +++ b/net/url_request/url_request_ftp_job.cc @@ -23,7 +23,8 @@ URLRequestFtpJob::URLRequestFtpJob(net::URLRequest* request) ALLOW_THIS_IN_INITIALIZER_LIST( read_callback_(this, &URLRequestFtpJob::OnReadCompleted)), read_in_progress_(false), - context_(request->context()) { + context_(request->context()), + ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { } URLRequestFtpJob::~URLRequestFtpJob() { @@ -61,8 +62,9 @@ void URLRequestFtpJob::Start() { void URLRequestFtpJob::Kill() { if (!transaction_.get()) return; - DestroyTransaction(); + transaction_.reset(); URLRequestJob::Kill(); + method_factory_.RevokeAll(); } net::LoadState URLRequestFtpJob::GetLoadState() const { @@ -111,8 +113,10 @@ void URLRequestFtpJob::CancelAuth() { // Once the auth is cancelled, we proceed with the request as though // there were no auth. Schedule this for later so that we don't cause // any recursing into the caller as a result of this call. - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( - this, &URLRequestFtpJob::OnStartCompleted, net::OK)); + MessageLoop::current()->PostTask( + FROM_HERE, + method_factory_.NewRunnableMethod( + &URLRequestFtpJob::OnStartCompleted, net::OK)); } bool URLRequestFtpJob::ReadRawData(net::IOBuffer* buf, @@ -138,13 +142,6 @@ bool URLRequestFtpJob::ReadRawData(net::IOBuffer* buf, } void URLRequestFtpJob::OnStartCompleted(int result) { - // If the request was destroyed, then there is no more work to do. - if (!request_ || !request_->delegate()) - return; - // If the transaction was destroyed, then the job was cancelled, and - // we can just ignore this notification. - if (!transaction_.get()) - return; // Clear the IO_PENDING status SetStatus(URLRequestStatus()); @@ -218,7 +215,7 @@ void URLRequestFtpJob::StartTransaction() { DCHECK(request_->context()->ftp_transaction_factory()); transaction_.reset( - request_->context()->ftp_transaction_factory()->CreateTransaction()); + request_->context()->ftp_transaction_factory()->CreateTransaction()); // No matter what, we want to report our status as IO pending since we will // be notifying our consumer asynchronously via OnStartCompleted. @@ -234,12 +231,8 @@ void URLRequestFtpJob::StartTransaction() { } // The transaction started synchronously, but we need to notify the // net::URLRequest delegate via the message loop. - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( - this, &URLRequestFtpJob::OnStartCompleted, rv)); -} - -void URLRequestFtpJob::DestroyTransaction() { - DCHECK(transaction_.get()); - - transaction_.reset(); + MessageLoop::current()->PostTask( + FROM_HERE, + method_factory_.NewRunnableMethod( + &URLRequestFtpJob::OnStartCompleted, rv)); } |