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

Unified Diff: net/url_request/view_cache_helper.cc

Issue 8680015: base::Bind: Convert view_http_cache_job_factory.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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/url_request/view_cache_helper.cc
diff --git a/net/url_request/view_cache_helper.cc b/net/url_request/view_cache_helper.cc
index 677e038a30e7f45b2bb191f8edc9d12b831fd63b..e0f6456ac29e6d67565a9c79adbadd3493ae644f 100644
--- a/net/url_request/view_cache_helper.cc
+++ b/net/url_request/view_cache_helper.cc
@@ -45,7 +45,6 @@ ViewCacheHelper::ViewCacheHelper()
buf_len_(0),
index_(0),
data_(NULL),
- callback_(NULL),
next_state_(STATE_NONE),
ALLOW_THIS_IN_INITIALIZER_LIST(
cache_callback_(this, &ViewCacheHelper::OnIOComplete)),
@@ -65,14 +64,14 @@ ViewCacheHelper::~ViewCacheHelper() {
int ViewCacheHelper::GetEntryInfoHTML(const std::string& key,
const URLRequestContext* context,
std::string* out,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return GetInfoHTML(key, context, std::string(), out, callback);
}
int ViewCacheHelper::GetContentsHTML(const URLRequestContext* context,
const std::string& url_prefix,
std::string* out,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return GetInfoHTML(std::string(), context, url_prefix, out, callback);
}
@@ -121,8 +120,8 @@ int ViewCacheHelper::GetInfoHTML(const std::string& key,
const URLRequestContext* context,
const std::string& url_prefix,
std::string* out,
- OldCompletionCallback* callback) {
- DCHECK(!callback_);
+ const CompletionCallback& callback) {
+ DCHECK(callback_.is_null());
DCHECK(context);
key_ = key;
context_ = context;
@@ -139,18 +138,17 @@ int ViewCacheHelper::GetInfoHTML(const std::string& key,
void ViewCacheHelper::DoCallback(int rv) {
DCHECK_NE(ERR_IO_PENDING, rv);
- DCHECK(callback_);
+ DCHECK(!callback_.is_null());
- OldCompletionCallback* c = callback_;
- callback_ = NULL;
- c->Run(rv);
+ callback_.Run(rv);
+ callback_.Reset();
}
void ViewCacheHelper::HandleResult(int rv) {
DCHECK_NE(ERR_IO_PENDING, rv);
DCHECK_NE(ERR_FAILED, rv);
context_ = NULL;
- if (callback_)
+ if (!callback_.is_null())
DoCallback(rv);
}

Powered by Google App Engine
This is Rietveld 408576698