summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-16 20:04:37 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-16 20:04:37 +0000
commit16359526ebc79731e7650f1e0d8fdbd400558ea1 (patch)
tree700c204a8e994b0c3e42b4d88b48c248d1353b6e /net
parent915f251d0504a176e4a612a2b2ff2b00592a8819 (diff)
downloadchromium_src-16359526ebc79731e7650f1e0d8fdbd400558ea1.zip
chromium_src-16359526ebc79731e7650f1e0d8fdbd400558ea1.tar.gz
chromium_src-16359526ebc79731e7650f1e0d8fdbd400558ea1.tar.bz2
Revert 114838 - base::Bind: Remove even moar OldCompletionCallback.
BUG=none TEST=none R=dpapad Review URL: http://codereview.chromium.org/8947024 TBR=jhawkins@chromium.org Review URL: http://codereview.chromium.org/8966031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/completion_callback.cc13
-rw-r--r--net/base/completion_callback.h6
-rw-r--r--net/disk_cache/backend_impl.cc84
-rw-r--r--net/disk_cache/backend_impl.h4
-rw-r--r--net/disk_cache/disk_cache.h2
-rw-r--r--net/disk_cache/disk_cache_test_base.cc8
-rw-r--r--net/disk_cache/entry_unittest.cc35
-rw-r--r--net/disk_cache/in_flight_backend_io.cc4
-rw-r--r--net/disk_cache/in_flight_backend_io.h7
-rw-r--r--net/disk_cache/mem_backend_impl.cc2
-rw-r--r--net/disk_cache/mem_backend_impl.h2
-rw-r--r--net/disk_cache/stress_cache.cc22
-rw-r--r--net/http/http_cache.cc3
-rw-r--r--net/http/mock_http_cache.cc40
-rw-r--r--net/http/mock_http_cache.h5
-rw-r--r--net/net.gyp1
-rw-r--r--net/tools/crash_cache/crash_cache.cc21
17 files changed, 120 insertions, 139 deletions
diff --git a/net/base/completion_callback.cc b/net/base/completion_callback.cc
deleted file mode 100644
index f697de1..0000000
--- a/net/base/completion_callback.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/base/completion_callback.h"
-
-namespace net {
-
-void OldCompletionCallbackAdapter(OldCompletionCallback* callback, int result) {
- callback->Run(result);
-}
-
-} // namespace net
diff --git a/net/base/completion_callback.h b/net/base/completion_callback.h
index 56883a2..cea6be3 100644
--- a/net/base/completion_callback.h
+++ b/net/base/completion_callback.h
@@ -17,12 +17,6 @@ namespace net {
typedef Callback1<int>::Type OldCompletionCallback;
typedef base::Callback<void(int)> CompletionCallback;
-// Temporary (in the code) adapter of OldCompletionCallback for use at call
-// sites that expect a CompletionCallback.
-//
-// TODO(jhawkins): Remove once OldCompletionCallback is removed.
-void OldCompletionCallbackAdapter(OldCompletionCallback* callback, int result);
-
// Used to implement a OldCompletionCallback.
template <class T>
class OldCompletionCallbackImpl :
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 847ecac..2cc2f3a 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -5,7 +5,6 @@
#include "net/disk_cache/backend_impl.h"
#include "base/bind.h"
-#include "base/bind_helpers.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/message_loop.h"
@@ -184,7 +183,7 @@ bool InitExperiment(disk_cache::IndexHeader* header, uint32 mask) {
}
if (!header->create_time || !header->lru.filled)
- return true; // Wait until we fill up the cache.
+ return true; // Wait untill we fill up the cache.
int index_load = header->num_entries * 100 / (mask + 1);
if (index_load > 25) {
@@ -219,29 +218,23 @@ class CacheCreator {
base::MessageLoopProxy* thread, net::NetLog* net_log,
disk_cache::Backend** backend,
net::OldCompletionCallback* callback)
- : path_(path),
- force_(force),
- retry_(false),
- max_bytes_(max_bytes),
- type_(type),
- flags_(flags),
- thread_(thread),
- backend_(backend),
- callback_(callback),
- cache_(NULL),
- net_log_(net_log) {
+ : path_(path), force_(force), retry_(false), max_bytes_(max_bytes),
+ type_(type), flags_(flags), thread_(thread), backend_(backend),
+ callback_(callback), cache_(NULL), net_log_(net_log),
+ ALLOW_THIS_IN_INITIALIZER_LIST(
+ my_callback_(this, &CacheCreator::OnIOComplete)) {
}
~CacheCreator() {}
// Creates the backend.
int Run();
- private:
- void DoCallback(int result);
-
// Callback implementation.
void OnIOComplete(int result);
+ private:
+ void DoCallback(int result);
+
const FilePath& path_;
bool force_;
bool retry_;
@@ -253,6 +246,7 @@ class CacheCreator {
net::OldCompletionCallback* callback_;
disk_cache::BackendImpl* cache_;
net::NetLog* net_log_;
+ net::OldCompletionCallbackImpl<CacheCreator> my_callback_;
DISALLOW_COPY_AND_ASSIGN(CacheCreator);
};
@@ -262,25 +256,11 @@ int CacheCreator::Run() {
cache_->SetMaxSize(max_bytes_);
cache_->SetType(type_);
cache_->SetFlags(flags_);
- int rv = cache_->Init(
- base::Bind(&CacheCreator::OnIOComplete, base::Unretained(this)));
+ int rv = cache_->Init(&my_callback_);
DCHECK_EQ(net::ERR_IO_PENDING, rv);
return rv;
}
-void CacheCreator::DoCallback(int result) {
- DCHECK_NE(net::ERR_IO_PENDING, result);
- if (result == net::OK) {
- *backend_ = cache_;
- } else {
- LOG(ERROR) << "Unable to create cache";
- *backend_ = NULL;
- delete cache_;
- }
- callback_->Run(result);
- delete this;
-}
-
void CacheCreator::OnIOComplete(int result) {
if (result == net::OK || !force_ || retry_)
return DoCallback(result);
@@ -299,9 +279,35 @@ void CacheCreator::OnIOComplete(int result) {
DCHECK_EQ(net::ERR_IO_PENDING, rv);
}
-// A callback to perform final cleanup on the background thread.
-void FinalCleanupCallback(disk_cache::BackendImpl* backend) {
- backend->CleanupCache();
+void CacheCreator::DoCallback(int result) {
+ DCHECK_NE(net::ERR_IO_PENDING, result);
+ if (result == net::OK) {
+ *backend_ = cache_;
+ } else {
+ LOG(ERROR) << "Unable to create cache";
+ *backend_ = NULL;
+ delete cache_;
+ }
+ callback_->Run(result);
+ delete this;
+}
+
+// ------------------------------------------------------------------------
+
+// A task to perform final cleanup on the background thread.
+class FinalCleanup : public Task {
+ public:
+ explicit FinalCleanup(disk_cache::BackendImpl* backend) : backend_(backend) {}
+ ~FinalCleanup() {}
+
+ virtual void Run();
+ private:
+ disk_cache::BackendImpl* backend_;
+ DISALLOW_EVIL_CONSTRUCTORS(FinalCleanup);
+};
+
+void FinalCleanup::Run() {
+ backend_->CleanupCache();
}
} // namespace
@@ -414,8 +420,8 @@ BackendImpl::~BackendImpl() {
// Unit tests may use the same thread for everything.
CleanupCache();
} else {
- background_queue_.background_thread()->PostTask(
- FROM_HERE, base::Bind(&FinalCleanupCallback, base::Unretained(this)));
+ background_queue_.background_thread()->PostTask(FROM_HERE,
+ new FinalCleanup(this));
done_.Wait();
}
}
@@ -443,7 +449,7 @@ int BackendImpl::CreateBackend(const FilePath& full_path, bool force,
return creator->Run();
}
-int BackendImpl::Init(const net::CompletionCallback& callback) {
+int BackendImpl::Init(OldCompletionCallback* callback) {
background_queue_.Init(callback);
return net::ERR_IO_PENDING;
}
@@ -1383,8 +1389,8 @@ int BackendImpl::CreateEntry(const std::string& key, Entry** entry,
}
int BackendImpl::DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) {
- DCHECK(!callback.is_null());
+ OldCompletionCallback* callback) {
+ DCHECK(callback);
background_queue_.DoomEntry(key, callback);
return net::ERR_IO_PENDING;
}
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index 6ef5906..6c76c2c 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -59,7 +59,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
OldCompletionCallback* callback);
// Performs general initialization for this current instance of the cache.
- int Init(const net::CompletionCallback& callback);
+ int Init(OldCompletionCallback* callback);
// Performs the actual initialization and final cleanup on destruction.
int SyncInit();
@@ -263,7 +263,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
virtual int CreateEntry(const std::string& key, Entry** entry,
OldCompletionCallback* callback) OVERRIDE;
virtual int DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) OVERRIDE;
+ OldCompletionCallback* callback) OVERRIDE;
virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE;
virtual int DoomEntriesBetween(
const base::Time initial_time,
diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h
index 59231f6..a678eec 100644
--- a/net/disk_cache/disk_cache.h
+++ b/net/disk_cache/disk_cache.h
@@ -92,7 +92,7 @@ class NET_EXPORT Backend {
// is a net error code. If this method returns ERR_IO_PENDING, the |callback|
// will be invoked after the entry is doomed.
virtual int DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) = 0;
+ OldCompletionCallback* callback) = 0;
// Marks all entries for deletion. The return value is a net error code. If
// this method returns ERR_IO_PENDING, the |callback| will be invoked when the
diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc
index 3182166..fef178e 100644
--- a/net/disk_cache/disk_cache_test_base.cc
+++ b/net/disk_cache/disk_cache_test_base.cc
@@ -119,8 +119,8 @@ int DiskCacheTestWithCache::CreateEntry(const std::string& key,
}
int DiskCacheTestWithCache::DoomEntry(const std::string& key) {
- net::TestCompletionCallback cb;
- int rv = cache_->DoomEntry(key, cb.callback());
+ TestOldCompletionCallback cb;
+ int rv = cache_->DoomEntry(key, &cb);
return cb.GetResult(rv);
}
@@ -304,7 +304,7 @@ void DiskCacheTestWithCache::InitDiskCacheImpl() {
cache_impl_->SetType(type_);
cache_impl_->SetFlags(disk_cache::kNoRandom);
- net::TestCompletionCallback cb;
- int rv = cache_impl_->Init(cb.callback());
+ TestOldCompletionCallback cb;
+ int rv = cache_impl_->Init(&cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
}
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index ef8ad89..c537ef1 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -1724,31 +1724,22 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyDoomSparseEntry) {
DoomSparseEntry();
}
-// A CompletionCallback wrapper that deletes the cache from within the callback.
-// The way an OldCompletionCallback works means that all tasks (even new ones)
-// are executed by the message loop before returning to the caller so the only
-// way to simulate a race is to execute what we want on the callback.
-class SparseTestCompletionCallback: public TestCompletionCallbackBase {
+// A OldCompletionCallback that deletes the cache from within the callback. The way
+// a TestOldCompletionCallback works means that all tasks (even new ones) are
+// executed by the message loop before returning to the caller so the only way
+// to simulate a race is to execute what we want on the callback.
+class SparseTestOldCompletionCallback : public TestOldCompletionCallback {
public:
- explicit SparseTestCompletionCallback(disk_cache::Backend* cache)
- : cache_(cache),
- ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
- base::Bind(&SparseTestCompletionCallback::OnComplete,
- base::Unretained(this)))) {
- }
-
- const net::CompletionCallback& callback() const { return callback_; }
+ explicit SparseTestOldCompletionCallback(disk_cache::Backend* cache)
+ : cache_(cache) {}
- private:
- void OnComplete(int result) {
+ virtual void RunWithParams(const Tuple1<int>& params) {
delete cache_;
- SetResult(result);
+ TestOldCompletionCallback::RunWithParams(params);
}
-
+ private:
disk_cache::Backend* cache_;
- net::CompletionCallback callback_;
-
- DISALLOW_COPY_AND_ASSIGN(SparseTestCompletionCallback);
+ DISALLOW_COPY_AND_ASSIGN(SparseTestOldCompletionCallback);
};
// Tests that we don't crash when the backend is deleted while we are working
@@ -1774,8 +1765,8 @@ TEST_F(DiskCacheEntryTest, DoomSparseEntry2) {
EXPECT_EQ(9, cache_->GetEntryCount());
entry->Close();
- SparseTestCompletionCallback cb(cache_);
- int rv = cache_->DoomEntry(key, cb.callback());
+ SparseTestOldCompletionCallback cb(cache_);
+ int rv = cache_->DoomEntry(key, &cb);
EXPECT_EQ(net::ERR_IO_PENDING, rv);
EXPECT_EQ(net::OK, cb.WaitForResult());
diff --git a/net/disk_cache/in_flight_backend_io.cc b/net/disk_cache/in_flight_backend_io.cc
index 30a5500..5cc6a65 100644
--- a/net/disk_cache/in_flight_backend_io.cc
+++ b/net/disk_cache/in_flight_backend_io.cc
@@ -314,7 +314,7 @@ InFlightBackendIO::InFlightBackendIO(BackendImpl* backend,
InFlightBackendIO::~InFlightBackendIO() {
}
-void InFlightBackendIO::Init(const net::CompletionCallback& callback) {
+void InFlightBackendIO::Init(OldCompletionCallback* callback) {
scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
operation->Init();
PostOperation(operation);
@@ -335,7 +335,7 @@ void InFlightBackendIO::CreateEntry(const std::string& key, Entry** entry,
}
void InFlightBackendIO::DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) {
+ OldCompletionCallback* callback) {
scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
operation->DoomEntry(key);
PostOperation(operation);
diff --git a/net/disk_cache/in_flight_backend_io.h b/net/disk_cache/in_flight_backend_io.h
index c3a52d5..8d4024a 100644
--- a/net/disk_cache/in_flight_backend_io.h
+++ b/net/disk_cache/in_flight_backend_io.h
@@ -149,14 +149,13 @@ class InFlightBackendIO : public InFlightIO {
base::MessageLoopProxy* background_thread);
virtual ~InFlightBackendIO();
- // Proxied operations.
- void Init(const net::CompletionCallback& callback);
+ // The operations we proxy:
+ void Init(net::OldCompletionCallback* callback);
void OpenEntry(const std::string& key, Entry** entry,
net::OldCompletionCallback* callback);
void CreateEntry(const std::string& key, Entry** entry,
net::OldCompletionCallback* callback);
- void DoomEntry(const std::string& key,
- const net::CompletionCallback& callback);
+ void DoomEntry(const std::string& key, net::OldCompletionCallback* callback);
void DoomAllEntries(const net::CompletionCallback& callback);
void DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
diff --git a/net/disk_cache/mem_backend_impl.cc b/net/disk_cache/mem_backend_impl.cc
index 89b5825..bd07af2 100644
--- a/net/disk_cache/mem_backend_impl.cc
+++ b/net/disk_cache/mem_backend_impl.cc
@@ -145,7 +145,7 @@ int MemBackendImpl::CreateEntry(const std::string& key, Entry** entry,
}
int MemBackendImpl::DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) {
+ OldCompletionCallback* callback) {
if (DoomEntry(key))
return net::OK;
diff --git a/net/disk_cache/mem_backend_impl.h b/net/disk_cache/mem_backend_impl.h
index 1b799f4..8793cec 100644
--- a/net/disk_cache/mem_backend_impl.h
+++ b/net/disk_cache/mem_backend_impl.h
@@ -69,7 +69,7 @@ class NET_EXPORT_PRIVATE MemBackendImpl : public Backend {
virtual int CreateEntry(const std::string& key, Entry** entry,
OldCompletionCallback* callback) OVERRIDE;
virtual int DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) OVERRIDE;
+ OldCompletionCallback* callback) OVERRIDE;
virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE;
virtual int DoomEntriesBetween(
const base::Time initial_time,
diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc
index 52abb16..a18df2a 100644
--- a/net/disk_cache/stress_cache.cc
+++ b/net/disk_cache/stress_cache.cc
@@ -113,8 +113,8 @@ void StressTheCache(int iteration) {
cache->SetMaxSize(cache_size);
cache->SetFlags(disk_cache::kNoLoadProtection);
- net::TestCompletionCallback cb;
- int rv = cache->Init(cb.callback());
+ TestOldCompletionCallback cb;
+ int rv = cache->Init(&cb);
if (cb.GetResult(rv) != net::OK) {
printf("Unable to initialize cache.\n");
@@ -154,24 +154,22 @@ void StressTheCache(int iteration) {
if (entries[slot])
entries[slot]->Close();
- TestOldCompletionCallback old_cb;
- rv = cache->OpenEntry(keys[key], &entries[slot], &old_cb);
- if (old_cb.GetResult(rv) != net::OK) {
- rv = cache->CreateEntry(keys[key], &entries[slot], &old_cb);
- CHECK_EQ(net::OK, old_cb.GetResult(rv));
+ rv = cache->OpenEntry(keys[key], &entries[slot], &cb);
+ if (cb.GetResult(rv) != net::OK) {
+ rv = cache->CreateEntry(keys[key], &entries[slot], &cb);
+ CHECK_EQ(net::OK, cb.GetResult(rv));
}
base::snprintf(buffer->data(), kSize,
"i: %d iter: %d, size: %d, truncate: %d ", i, iteration,
size, truncate ? 1 : 0);
- rv = entries[slot]->WriteData(0, 0, buffer, size, &old_cb, truncate);
- CHECK_EQ(size, old_cb.GetResult(rv));
+ rv = entries[slot]->WriteData(0, 0, buffer, size, &cb, truncate);
+ CHECK_EQ(size, cb.GetResult(rv));
if (rand() % 100 > 80) {
key = rand() % kNumKeys;
- net::TestCompletionCallback cb2;
- rv = cache->DoomEntry(keys[key], cb2.callback());
- cb2.GetResult(rv);
+ rv = cache->DoomEntry(keys[key], &cb);
+ cb.GetResult(rv);
}
if (!(i % 100))
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 8ee0ac6..78b0eaf 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -638,8 +638,7 @@ int HttpCache::AsyncDoomEntry(const std::string& key, Transaction* trans) {
BackendCallback* my_callback = new BackendCallback(this, pending_op);
pending_op->callback = my_callback;
- int rv = disk_cache_->DoomEntry(
- key, base::Bind(&net::OldCompletionCallbackAdapter, my_callback));
+ int rv = disk_cache_->DoomEntry(key, my_callback);
if (rv != ERR_IO_PENDING) {
item->ClearTransaction();
my_callback->Run(rv);
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc
index c53453c..5fe148e 100644
--- a/net/http/mock_http_cache.cc
+++ b/net/http/mock_http_cache.cc
@@ -11,10 +11,6 @@
namespace {
-// We can override the test mode for a given operation by setting this global
-// variable.
-int g_test_mode = 0;
-
int GetTestModeForEntry(const std::string& key) {
// 'key' is prefixed with an identifier if it corresponds to a cached POST.
// Skip past that to locate the actual URL.
@@ -35,9 +31,9 @@ int GetTestModeForEntry(const std::string& key) {
return t->test_mode;
}
-void CallbackForwader(const net::CompletionCallback& callback, int result) {
- callback.Run(result);
-}
+// We can override the test mode for a given operation by setting this global
+// variable.
+int g_test_mode = 0;
} // namespace
@@ -329,6 +325,20 @@ bool MockDiskEntry::ignore_callbacks_ = false;
//-----------------------------------------------------------------------------
+class MockDiskCache::CallbackRunner : public Task {
+ public:
+ CallbackRunner(net::OldCompletionCallback* callback, int result)
+ : callback_(callback), result_(result) {}
+ virtual void Run() {
+ callback_->Run(result_);
+ }
+
+ private:
+ net::OldCompletionCallback* callback_;
+ int result_;
+ DISALLOW_COPY_AND_ASSIGN(CallbackRunner);
+};
+
MockDiskCache::MockDiskCache()
: open_count_(0), create_count_(0), fail_requests_(false),
soft_failures_(false), double_create_check_(true) {
@@ -369,8 +379,7 @@ int MockDiskCache::OpenEntry(const std::string& key, disk_cache::Entry** entry,
if (GetTestModeForEntry(key) & TEST_MODE_SYNC_CACHE_START)
return net::OK;
- CallbackLater(
- base::Bind(&net::OldCompletionCallbackAdapter, callback), net::OK);
+ CallbackLater(callback, net::OK);
return net::ERR_IO_PENDING;
}
@@ -409,14 +418,13 @@ int MockDiskCache::CreateEntry(const std::string& key,
if (GetTestModeForEntry(key) & TEST_MODE_SYNC_CACHE_START)
return net::OK;
- CallbackLater(
- base::Bind(&net::OldCompletionCallbackAdapter, callback), net::OK);
+ CallbackLater(callback, net::OK);
return net::ERR_IO_PENDING;
}
int MockDiskCache::DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) {
- DCHECK(!callback.is_null());
+ net::OldCompletionCallback* callback) {
+ DCHECK(callback);
EntryMap::iterator it = entries_.find(key);
if (it != entries_.end()) {
it->second->Release();
@@ -467,10 +475,10 @@ void MockDiskCache::ReleaseAll() {
entries_.clear();
}
-void MockDiskCache::CallbackLater(const net::CompletionCallback& callback,
+void MockDiskCache::CallbackLater(net::OldCompletionCallback* callback,
int result) {
- MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(&CallbackForwader, callback, result));
+ MessageLoop::current()->PostTask(FROM_HERE,
+ new CallbackRunner(callback, result));
}
//-----------------------------------------------------------------------------
diff --git a/net/http/mock_http_cache.h b/net/http/mock_http_cache.h
index d934e49..8e492a9 100644
--- a/net/http/mock_http_cache.h
+++ b/net/http/mock_http_cache.h
@@ -101,7 +101,7 @@ class MockDiskCache : public disk_cache::Backend {
virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry,
net::OldCompletionCallback* callback) OVERRIDE;
virtual int DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) OVERRIDE;
+ net::OldCompletionCallback* callback) OVERRIDE;
virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE;
virtual int DoomEntriesBetween(
const base::Time initial_time,
@@ -135,8 +135,9 @@ class MockDiskCache : public disk_cache::Backend {
private:
typedef base::hash_map<std::string, MockDiskEntry*> EntryMap;
+ class CallbackRunner;
- void CallbackLater(const net::CompletionCallback& callback, int result);
+ void CallbackLater(net::OldCompletionCallback* callback, int result);
EntryMap entries_;
int open_count_;
diff --git a/net/net.gyp b/net/net.gyp
index b549e88..564976b 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -72,7 +72,6 @@
'base/cert_verifier.h',
'base/cert_verify_result.cc',
'base/cert_verify_result.h',
- 'base/completion_callback.cc',
'base/completion_callback.h',
'base/connection_type_histograms.cc',
'base/connection_type_histograms.h',
diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc
index a8f6cdc..9916dd6 100644
--- a/net/tools/crash_cache/crash_cache.cc
+++ b/net/tools/crash_cache/crash_cache.cc
@@ -265,9 +265,8 @@ int LoadOperations(const FilePath& path, RankCrashes action,
// No experiments and use a simple LRU.
cache->SetFlags(disk_cache::kNoRandom);
- TestOldCompletionCallback old_cb;
- net::TestCompletionCallback cb;
- int rv = cache->Init(cb.callback());
+ TestOldCompletionCallback cb;
+ int rv = cache->Init(&cb);
if (cb.GetResult(rv) != net::OK || cache->GetEntryCount())
return GENERIC;
@@ -277,14 +276,14 @@ int LoadOperations(const FilePath& path, RankCrashes action,
disk_cache::Entry* entry;
for (int i = 0; i < 100; i++) {
std::string key = GenerateKey(true);
- rv = cache->CreateEntry(key, &entry, &old_cb);
- if (old_cb.GetResult(rv) != net::OK)
+ rv = cache->CreateEntry(key, &entry, &cb);
+ if (cb.GetResult(rv) != net::OK)
return GENERIC;
entry->Close();
FlushQueue(cache);
if (50 == i && action >= disk_cache::REMOVE_LOAD_1) {
- rv = cache->CreateEntry(kCrashEntryName, &entry, &old_cb);
- if (old_cb.GetResult(rv) != net::OK)
+ rv = cache->CreateEntry(kCrashEntryName, &entry, &cb);
+ if (cb.GetResult(rv) != net::OK)
return GENERIC;
entry->Close();
FlushQueue(cache);
@@ -294,13 +293,13 @@ int LoadOperations(const FilePath& path, RankCrashes action,
if (action <= disk_cache::INSERT_LOAD_2) {
disk_cache::g_rankings_crash = action;
- rv = cache->CreateEntry(kCrashEntryName, &entry, &old_cb);
- if (old_cb.GetResult(rv) != net::OK)
+ rv = cache->CreateEntry(kCrashEntryName, &entry, &cb);
+ if (cb.GetResult(rv) != net::OK)
return GENERIC;
}
- rv = cache->OpenEntry(kCrashEntryName, &entry, &old_cb);
- if (old_cb.GetResult(rv) != net::OK)
+ rv = cache->OpenEntry(kCrashEntryName, &entry, &cb);
+ if (cb.GetResult(rv) != net::OK)
return GENERIC;
disk_cache::g_rankings_crash = action;