diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-22 05:18:12 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-22 05:18:12 +0000 |
commit | a32f758447553c5d7e1684e2527cd92e3825ebaa (patch) | |
tree | 64da8b6278f6d26ea207809e5cc2dcbfeb072665 /net/url_request/view_cache_helper.cc | |
parent | 72a3ce556f70637bfa196901c92652d023b96f7f (diff) | |
download | chromium_src-a32f758447553c5d7e1684e2527cd92e3825ebaa.zip chromium_src-a32f758447553c5d7e1684e2527cd92e3825ebaa.tar.gz chromium_src-a32f758447553c5d7e1684e2527cd92e3825ebaa.tar.bz2 |
base::Bind: Finish up net/url_request.
BUG=none
TEST=none
R=csilv
Review URL: http://codereview.chromium.org/9017041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request/view_cache_helper.cc')
-rw-r--r-- | net/url_request/view_cache_helper.cc | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/net/url_request/view_cache_helper.cc b/net/url_request/view_cache_helper.cc index e5980d9..4dab89d 100644 --- a/net/url_request/view_cache_helper.cc +++ b/net/url_request/view_cache_helper.cc @@ -48,17 +48,12 @@ ViewCacheHelper::ViewCacheHelper() index_(0), data_(NULL), next_state_(STATE_NONE), - ALLOW_THIS_IN_INITIALIZER_LIST( - entry_callback_(new CancelableOldCompletionCallback<ViewCacheHelper>( - this, &ViewCacheHelper::OnIOComplete))) { + ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { } ViewCacheHelper::~ViewCacheHelper() { if (entry_) entry_->Close(); - - // Cancel any pending entry callback. - entry_callback_->Cancel(); } int ViewCacheHelper::GetEntryInfoHTML(const std::string& key, @@ -286,18 +281,16 @@ int ViewCacheHelper::DoOpenEntryComplete(int result) { int ViewCacheHelper::DoReadResponse() { next_state_ = STATE_READ_RESPONSE_COMPLETE; buf_len_ = entry_->GetDataSize(0); - entry_callback_->AddRef(); if (!buf_len_) return buf_len_; buf_ = new IOBuffer(buf_len_); return entry_->ReadData( 0, 0, buf_, buf_len_, - base::Bind(&net::OldCompletionCallbackAdapter, entry_callback_)); + base::Bind(&ViewCacheHelper::OnIOComplete, weak_factory_.GetWeakPtr())); } int ViewCacheHelper::DoReadResponseComplete(int result) { - entry_callback_->Release(); if (result && result == buf_len_) { HttpResponseInfo response; bool truncated; @@ -333,18 +326,16 @@ int ViewCacheHelper::DoReadData() { next_state_ = STATE_READ_DATA_COMPLETE; buf_len_ = entry_->GetDataSize(index_); - entry_callback_->AddRef(); if (!buf_len_) return buf_len_; buf_ = new IOBuffer(buf_len_); return entry_->ReadData( index_, 0, buf_, buf_len_, - base::Bind(&net::OldCompletionCallbackAdapter, entry_callback_)); + base::Bind(&ViewCacheHelper::OnIOComplete, weak_factory_.GetWeakPtr())); } int ViewCacheHelper::DoReadDataComplete(int result) { - entry_callback_->Release(); if (result && result == buf_len_) { HexDump(buf_->data(), buf_len_, data_); } |