[go: nahoru, domu]

base::Bind: Convert most of net/http.

BUG=none
TEST=none
R=csilv

Review URL: http://codereview.chromium.org/8990001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115220 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/http/partial_data.cc b/net/http/partial_data.cc
index 4bdedac..24bf4f5a 100644
--- a/net/http/partial_data.cc
+++ b/net/http/partial_data.cc
@@ -115,8 +115,7 @@
       sparse_entry_(true),
       truncated_(false),
       initial_validation_(false),
-      core_(NULL),
-      callback_(NULL) {
+      core_(NULL) {
 }
 
 PartialData::~PartialData() {
@@ -162,7 +161,7 @@
 }
 
 int PartialData::ShouldValidateCache(disk_cache::Entry* entry,
-                                     OldCompletionCallback* callback) {
+                                     const CompletionCallback& callback) {
   DCHECK_GE(current_range_start_, 0);
 
   // Scan the disk cache for the first cached portion within this range.
@@ -173,7 +172,7 @@
   DVLOG(3) << "ShouldValidateCache len: " << len;
 
   if (sparse_entry_) {
-    DCHECK(!callback_);
+    DCHECK(callback_.is_null());
     Core* core = Core::CreateCore(this);
     cached_min_len_ = core->GetAvailableRange(entry, current_range_start_, len,
                                               &cached_start_);
@@ -481,7 +480,7 @@
 }
 
 void PartialData::GetAvailableRangeCompleted(int result, int64 start) {
-  DCHECK(callback_);
+  DCHECK(!callback_.is_null());
   DCHECK_NE(ERR_IO_PENDING, result);
 
   cached_start_ = start;
@@ -489,9 +488,9 @@
   if (result >= 0)
     result = 1;  // Return success, go ahead and validate the entry.
 
-  OldCompletionCallback* cb = callback_;
-  callback_ = NULL;
-  cb->Run(result);
+  CompletionCallback cb = callback_;
+  callback_.Reset();
+  cb.Run(result);
 }
 
 }  // namespace net