Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Unified Diff: net/http/http_cache.cc

Issue 8990001: base::Bind: Convert most of net/http. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clang. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/http/http_cache.cc
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 1dcb368e6a3b4c25a26dafc939d2d2de3b513181..a63832614a951cdf999bc69e2b75a3cb0907131f 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -163,7 +163,7 @@ class HttpCache::WorkItem {
if (entry_)
*entry_ = entry;
if (trans_)
- trans_->io_callback()->Run(result);
+ trans_->io_callback().Run(result);
}
// Notifies the caller about the operation completion. Returns true if the
@@ -231,12 +231,12 @@ class HttpCache::BackendCallback : public CallbackRunner<Tuple1<int> > {
class HttpCache::MetadataWriter {
public:
explicit MetadataWriter(HttpCache::Transaction* trans)
- : transaction_(trans),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- callback_(this, &MetadataWriter::OnIOComplete)) {}
+ : transaction_(trans) {
+ }
+
~MetadataWriter() {}
- // Implementes the bulk of HttpCache::WriteMetadata.
+ // Implements the bulk of HttpCache::WriteMetadata.
void Write(const GURL& url, base::Time expected_response_time, IOBuffer* buf,
int buf_len);
@@ -250,7 +250,6 @@ class HttpCache::MetadataWriter {
scoped_refptr<IOBuffer> buf_;
int buf_len_;
base::Time expected_response_time_;
- OldCompletionCallbackImpl<MetadataWriter> callback_;
HttpRequestInfo request_info_;
DISALLOW_COPY_AND_ASSIGN(MetadataWriter);
};
@@ -270,7 +269,10 @@ void HttpCache::MetadataWriter::Write(const GURL& url,
buf_len_ = buf_len;
verified_ = false;
- int rv = transaction_->Start(&request_info_, &callback_, BoundNetLog());
+ int rv = transaction_->Start(
+ &request_info_,
+ base::Bind(&MetadataWriter::OnIOComplete, base::Unretained(this)),
+ BoundNetLog());
if (rv != ERR_IO_PENDING)
VerifyResponse(rv);
}
@@ -907,7 +909,7 @@ void HttpCache::DoneWritingToEntry(ActiveEntry* entry, bool success) {
// be added to a new entry.
while (!pending_queue.empty()) {
// ERR_CACHE_RACE causes the transaction to restart the whole process.
- pending_queue.front()->io_callback()->Run(ERR_CACHE_RACE);
+ pending_queue.front()->io_callback().Run(ERR_CACHE_RACE);
pending_queue.pop_front();
}
}
@@ -1051,7 +1053,7 @@ void HttpCache::OnProcessPendingQueue(ActiveEntry* entry) {
int rv = AddTransactionToEntry(entry, next);
if (rv != ERR_IO_PENDING) {
- next->io_callback()->Run(rv);
+ next->io_callback().Run(rv);
}
}

Powered by Google App Engine
This is Rietveld 408576698