diff options
Diffstat (limited to 'net/disk_cache')
| -rw-r--r-- | net/disk_cache/backend_impl.cc | 32 | ||||
| -rw-r--r-- | net/disk_cache/backend_impl.h | 24 | ||||
| -rw-r--r-- | net/disk_cache/backend_unittest.cc | 12 | ||||
| -rw-r--r-- | net/disk_cache/disk_cache.h | 30 | ||||
| -rw-r--r-- | net/disk_cache/disk_cache_perftest.cc | 6 | ||||
| -rw-r--r-- | net/disk_cache/disk_cache_test_base.cc | 32 | ||||
| -rw-r--r-- | net/disk_cache/entry_impl.cc | 30 | ||||
| -rw-r--r-- | net/disk_cache/entry_impl.h | 26 | ||||
| -rw-r--r-- | net/disk_cache/entry_unittest.cc | 28 | ||||
| -rw-r--r-- | net/disk_cache/in_flight_backend_io.cc | 36 | ||||
| -rw-r--r-- | net/disk_cache/in_flight_backend_io.h | 42 | ||||
| -rw-r--r-- | net/disk_cache/mem_backend_impl.cc | 14 | ||||
| -rw-r--r-- | net/disk_cache/mem_backend_impl.h | 14 | ||||
| -rw-r--r-- | net/disk_cache/mem_entry_impl.cc | 12 | ||||
| -rw-r--r-- | net/disk_cache/mem_entry_impl.h | 12 | ||||
| -rw-r--r-- | net/disk_cache/sparse_control.cc | 10 | ||||
| -rw-r--r-- | net/disk_cache/sparse_control.h | 10 | ||||
| -rw-r--r-- | net/disk_cache/stress_cache.cc | 2 |
18 files changed, 186 insertions, 186 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 1a63d16..3903a58 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -216,7 +216,7 @@ class CacheCreator { net::CacheType type, uint32 flags, base::MessageLoopProxy* thread, net::NetLog* net_log, disk_cache::Backend** backend, - net::CompletionCallback* callback) + 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), @@ -242,10 +242,10 @@ class CacheCreator { uint32 flags_; scoped_refptr<base::MessageLoopProxy> thread_; disk_cache::Backend** backend_; - net::CompletionCallback* callback_; + net::OldCompletionCallback* callback_; disk_cache::BackendImpl* cache_; net::NetLog* net_log_; - net::CompletionCallbackImpl<CacheCreator> my_callback_; + net::OldCompletionCallbackImpl<CacheCreator> my_callback_; DISALLOW_COPY_AND_ASSIGN(CacheCreator); }; @@ -318,7 +318,7 @@ namespace disk_cache { int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, bool force, base::MessageLoopProxy* thread, net::NetLog* net_log, Backend** backend, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(callback); if (type == net::MEMORY_CACHE) { *backend = MemBackendImpl::CreateBackend(max_bytes, net_log); @@ -439,7 +439,7 @@ int BackendImpl::CreateBackend(const FilePath& full_path, bool force, int max_bytes, net::CacheType type, uint32 flags, base::MessageLoopProxy* thread, net::NetLog* net_log, Backend** backend, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(callback); CacheCreator* creator = new CacheCreator(full_path, force, max_bytes, type, flags, thread, net_log, backend, @@ -448,7 +448,7 @@ int BackendImpl::CreateBackend(const FilePath& full_path, bool force, return creator->Run(); } -int BackendImpl::Init(CompletionCallback* callback) { +int BackendImpl::Init(OldCompletionCallback* callback) { background_queue_.Init(callback); return net::ERR_IO_PENDING; } @@ -560,7 +560,7 @@ void BackendImpl::CleanupCache() { // ------------------------------------------------------------------------ int BackendImpl::OpenPrevEntry(void** iter, Entry** prev_entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(callback); background_queue_.OpenPrevEntry(iter, prev_entry, callback); return net::ERR_IO_PENDING; @@ -1257,12 +1257,12 @@ void BackendImpl::ClearRefCountForTest() { num_refs_ = 0; } -int BackendImpl::FlushQueueForTest(CompletionCallback* callback) { +int BackendImpl::FlushQueueForTest(OldCompletionCallback* callback) { background_queue_.FlushQueue(callback); return net::ERR_IO_PENDING; } -int BackendImpl::RunTaskForTest(Task* task, CompletionCallback* callback) { +int BackendImpl::RunTaskForTest(Task* task, OldCompletionCallback* callback) { background_queue_.RunTask(task, callback); return net::ERR_IO_PENDING; } @@ -1315,27 +1315,27 @@ int32 BackendImpl::GetEntryCount() const { } int BackendImpl::OpenEntry(const std::string& key, Entry** entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(callback); background_queue_.OpenEntry(key, entry, callback); return net::ERR_IO_PENDING; } int BackendImpl::CreateEntry(const std::string& key, Entry** entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(callback); background_queue_.CreateEntry(key, entry, callback); return net::ERR_IO_PENDING; } int BackendImpl::DoomEntry(const std::string& key, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(callback); background_queue_.DoomEntry(key, callback); return net::ERR_IO_PENDING; } -int BackendImpl::DoomAllEntries(CompletionCallback* callback) { +int BackendImpl::DoomAllEntries(OldCompletionCallback* callback) { DCHECK(callback); background_queue_.DoomAllEntries(callback); return net::ERR_IO_PENDING; @@ -1343,21 +1343,21 @@ int BackendImpl::DoomAllEntries(CompletionCallback* callback) { int BackendImpl::DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(callback); background_queue_.DoomEntriesBetween(initial_time, end_time, callback); return net::ERR_IO_PENDING; } int BackendImpl::DoomEntriesSince(const base::Time initial_time, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(callback); background_queue_.DoomEntriesSince(initial_time, callback); return net::ERR_IO_PENDING; } int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(callback); background_queue_.OpenNextEntry(iter, next_entry, callback); return net::ERR_IO_PENDING; diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h index eddae3a..8bd793c 100644 --- a/net/disk_cache/backend_impl.h +++ b/net/disk_cache/backend_impl.h @@ -55,10 +55,10 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { int max_bytes, net::CacheType type, uint32 flags, base::MessageLoopProxy* thread, net::NetLog* net_log, Backend** backend, - CompletionCallback* callback); + OldCompletionCallback* callback); // Performs general initialization for this current instance of the cache. - int Init(CompletionCallback* callback); + int Init(OldCompletionCallback* callback); // Performs the actual initialization and final cleanup on destruction. int SyncInit(); @@ -66,7 +66,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { // Same bahavior as OpenNextEntry but walks the list from back to front. int OpenPrevEntry(void** iter, Entry** prev_entry, - CompletionCallback* callback); + OldCompletionCallback* callback); // Synchronous implementation of the asynchronous interface. int SyncOpenEntry(const std::string& key, Entry** entry); @@ -229,11 +229,11 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { void ClearRefCountForTest(); // Sends a dummy operation through the operation queue, for unit tests. - int FlushQueueForTest(CompletionCallback* callback); + int FlushQueueForTest(OldCompletionCallback* callback); // Runs the provided task on the cache thread. The task will be automatically // deleted after it runs. - int RunTaskForTest(Task* task, CompletionCallback* callback); + int RunTaskForTest(Task* task, OldCompletionCallback* callback); // Trims an entry (all if |empty| is true) from the list of deleted // entries. This method should be called directly on the cache thread. @@ -250,18 +250,18 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { // Backend interface. virtual int32 GetEntryCount() const; virtual int OpenEntry(const std::string& key, Entry** entry, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual int CreateEntry(const std::string& key, Entry** entry, - CompletionCallback* callback); - virtual int DoomEntry(const std::string& key, CompletionCallback* callback); - virtual int DoomAllEntries(CompletionCallback* callback); + OldCompletionCallback* callback); + virtual int DoomEntry(const std::string& key, OldCompletionCallback* callback); + virtual int DoomAllEntries(OldCompletionCallback* callback); virtual int DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual int DoomEntriesSince(const base::Time initial_time, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual int OpenNextEntry(void** iter, Entry** next_entry, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual void EndEnumeration(void** iter); virtual void GetStats(StatsItems* stats); virtual void OnExternalCacheHit(const std::string& key); diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 7843768..bae4649 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -195,7 +195,7 @@ TEST_F(DiskCacheBackendTest, AppCacheKeying) { } TEST_F(DiskCacheTest, CreateBackend) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; { FilePath path = GetCacheFilePath(); @@ -261,7 +261,7 @@ TEST_F(DiskCacheBackendTest, ExternalFiles) { // Tests that we deal with file-level pending operations at destruction time. TEST_F(DiskCacheTest, ShutdownWithPendingIO) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; { FilePath path = GetCacheFilePath(); @@ -313,7 +313,7 @@ TEST_F(DiskCacheTest, ShutdownWithPendingIO) { // Tests that we deal with background-thread pending operations. TEST_F(DiskCacheTest, ShutdownWithPendingIO2) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; { FilePath path = GetCacheFilePath(); @@ -357,7 +357,7 @@ TEST_F(DiskCacheTest, TruncatedIndex) { base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( base::Thread::Options(MessageLoop::TYPE_IO, 0))); - TestCompletionCallback cb; + TestOldCompletionCallback cb; disk_cache::Backend* backend = NULL; int rv = disk_cache::BackendImpl::CreateBackend( @@ -1342,7 +1342,7 @@ TEST_F(DiskCacheTest, DeleteOld) { base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( base::Thread::Options(MessageLoop::TYPE_IO, 0))); - TestCompletionCallback cb; + TestOldCompletionCallback cb; disk_cache::Backend* cache; int rv = disk_cache::BackendImpl::CreateBackend( @@ -2269,7 +2269,7 @@ TEST_F(DiskCacheTest, MultipleInstances) { base::Thread cache_thread("CacheThread"); ASSERT_TRUE(cache_thread.StartWithOptions( base::Thread::Options(MessageLoop::TYPE_IO, 0))); - TestCompletionCallback cb; + TestOldCompletionCallback cb; const int kNumberOfCaches = 2; disk_cache::Backend* cache[kNumberOfCaches]; diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h index 516edb5..3e0efa6 100644 --- a/net/disk_cache/disk_cache.h +++ b/net/disk_cache/disk_cache.h @@ -33,7 +33,7 @@ namespace disk_cache { class Entry; class Backend; -typedef net::CompletionCallback CompletionCallback; +typedef net::OldCompletionCallback OldCompletionCallback; // Returns an instance of a Backend of the given |type|. |path| points to a // folder where the cached data will be stored (if appropriate). This cache @@ -54,7 +54,7 @@ NET_EXPORT int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, bool force, base::MessageLoopProxy* thread, net::NetLog* net_log, Backend** backend, - CompletionCallback* callback); + OldCompletionCallback* callback); // The root interface for a disk cache instance. class NET_EXPORT Backend { @@ -77,7 +77,7 @@ class NET_EXPORT Backend { // will be invoked when the entry is available. The pointer to receive the // |entry| must remain valid until the operation completes. virtual int OpenEntry(const std::string& key, Entry** entry, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; // Creates a new entry. Upon success, the out param holds a pointer to an // Entry object representing the newly created disk cache entry. When the @@ -86,18 +86,18 @@ class NET_EXPORT Backend { // the |callback| will be invoked when the entry is available. The pointer to // receive the |entry| must remain valid until the operation completes. virtual int CreateEntry(const std::string& key, Entry** entry, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; // Marks the entry, specified by the given key, for deletion. The return value // 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, - 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 // operation completes. - virtual int DoomAllEntries(CompletionCallback* callback) = 0; + virtual int DoomAllEntries(OldCompletionCallback* callback) = 0; // Marks a range of entries for deletion. This supports unbounded deletes in // either direction by using null Time values for either argument. The return @@ -105,13 +105,13 @@ class NET_EXPORT Backend { // |callback| will be invoked when the operation completes. virtual int DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; // Marks all entries accessed since |initial_time| for deletion. The return // value is a net error code. If this method returns ERR_IO_PENDING, the // |callback| will be invoked when the operation completes. virtual int DoomEntriesSince(const base::Time initial_time, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; // Enumerates the cache. Initialize |iter| to NULL before calling this method // the first time. That will cause the enumeration to start at the head of @@ -126,7 +126,7 @@ class NET_EXPORT Backend { // NOTE: This method does not modify the last_used field of the entry, and // therefore it does not impact the eviction ranking of the entry. virtual int OpenNextEntry(void** iter, Entry** next_entry, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; // Releases iter without returning the next entry. Whenever OpenNextEntry() // returns true, but the caller is not interested in continuing the @@ -178,7 +178,7 @@ class NET_EXPORT Entry { // having to wait for all the callbacks, and still rely on the cleanup // performed from the callback code. virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* completion_callback) = 0; + OldCompletionCallback* completion_callback) = 0; // Copies cache data from the given buffer of length |buf_len|. If // completion_callback is null, then this call blocks until the write @@ -194,7 +194,7 @@ class NET_EXPORT Entry { // If truncate is true, this call will truncate the stored data at the end of // what we are writing here. virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* completion_callback, + OldCompletionCallback* completion_callback, bool truncate) = 0; // Sparse entries support: @@ -242,7 +242,7 @@ class NET_EXPORT Entry { // Behaves like ReadData() except that this method is used to access sparse // entries. virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* completion_callback) = 0; + OldCompletionCallback* completion_callback) = 0; // Behaves like WriteData() except that this method is used to access sparse // entries. |truncate| is not part of this interface because a sparse entry @@ -251,7 +251,7 @@ class NET_EXPORT Entry { // that the content has changed), the whole entry should be doomed and // re-created. virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* completion_callback) = 0; + OldCompletionCallback* completion_callback) = 0; // Returns information about the currently stored portion of a sparse entry. // |offset| and |len| describe a particular range that should be scanned to @@ -263,7 +263,7 @@ class NET_EXPORT Entry { // this method returns ERR_IO_PENDING, the |callback| will be invoked when the // operation completes, and |start| must remain valid until that point. virtual int GetAvailableRange(int64 offset, int len, int64* start, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; // Returns true if this entry could be a sparse entry or false otherwise. This // is a quick test that may return true even if the entry is not really @@ -293,7 +293,7 @@ class NET_EXPORT Entry { // Note that CancelSparseIO may have been called on another instance of this // object that refers to the same physical disk entry. // Note: This method is deprecated. - virtual int ReadyForSparseIO(CompletionCallback* completion_callback) = 0; + virtual int ReadyForSparseIO(OldCompletionCallback* completion_callback) = 0; protected: virtual ~Entry() {} diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc index 2adc29b..4bf46f7 100644 --- a/net/disk_cache/disk_cache_perftest.cc +++ b/net/disk_cache/disk_cache_perftest.cc @@ -61,7 +61,7 @@ bool TimeWrite(int num_entries, disk_cache::Backend* cache, entries->push_back(entry); disk_cache::Entry* cache_entry; - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache->CreateEntry(entry.key, &cache_entry, &cb); if (net::OK != cb.GetResult(rv)) break; @@ -107,7 +107,7 @@ bool TimeRead(int num_entries, disk_cache::Backend* cache, for (int i = 0; i < num_entries; i++) { disk_cache::Entry* cache_entry; - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache->OpenEntry(entries[i].key, &cache_entry, &cb); if (net::OK != cb.GetResult(rv)) break; @@ -158,7 +158,7 @@ TEST_F(DiskCacheTest, CacheBackendPerformance) { base::Thread::Options(MessageLoop::TYPE_IO, 0))); ScopedTestCache test_cache; - TestCompletionCallback cb; + TestOldCompletionCallback cb; disk_cache::Backend* cache; int rv = disk_cache::CreateCacheBackend( net::DISK_CACHE, test_cache.path(), 0, false, diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc index b9e1d10..c200328 100644 --- a/net/disk_cache/disk_cache_test_base.cc +++ b/net/disk_cache/disk_cache_test_base.cc @@ -51,7 +51,7 @@ void DiskCacheTestWithCache::InitCache() { // We are expected to leak memory when simulating crashes. void DiskCacheTestWithCache::SimulateCrash() { ASSERT_TRUE(implementation_ && !memory_only_); - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_impl_->FlushQueueForTest(&cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); cache_impl_->ClearRefCountForTest(); @@ -79,46 +79,46 @@ void DiskCacheTestWithCache::SetMaxSize(int size) { int DiskCacheTestWithCache::OpenEntry(const std::string& key, disk_cache::Entry** entry) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_->OpenEntry(key, entry, &cb); return cb.GetResult(rv); } int DiskCacheTestWithCache::CreateEntry(const std::string& key, disk_cache::Entry** entry) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_->CreateEntry(key, entry, &cb); return cb.GetResult(rv); } int DiskCacheTestWithCache::DoomEntry(const std::string& key) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_->DoomEntry(key, &cb); return cb.GetResult(rv); } int DiskCacheTestWithCache::DoomAllEntries() { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_->DoomAllEntries(&cb); return cb.GetResult(rv); } int DiskCacheTestWithCache::DoomEntriesBetween(const base::Time initial_time, const base::Time end_time) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_->DoomEntriesBetween(initial_time, end_time, &cb); return cb.GetResult(rv); } int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_->DoomEntriesSince(initial_time, &cb); return cb.GetResult(rv); } int DiskCacheTestWithCache::OpenNextEntry(void** iter, disk_cache::Entry** next_entry) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_->OpenNextEntry(iter, next_entry, &cb); return cb.GetResult(rv); } @@ -127,7 +127,7 @@ void DiskCacheTestWithCache::FlushQueueForTest() { if (memory_only_ || !cache_impl_) return; - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_impl_->FlushQueueForTest(&cb); EXPECT_EQ(net::OK, cb.GetResult(rv)); } @@ -139,14 +139,14 @@ void DiskCacheTestWithCache::RunTaskForTest(Task* task) { return; } - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_impl_->RunTaskForTest(task, &cb); EXPECT_EQ(net::OK, cb.GetResult(rv)); } int DiskCacheTestWithCache::ReadData(disk_cache::Entry* entry, int index, int offset, net::IOBuffer* buf, int len) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = entry->ReadData(index, offset, buf, len, &cb); return cb.GetResult(rv); } @@ -155,7 +155,7 @@ int DiskCacheTestWithCache::ReadData(disk_cache::Entry* entry, int index, int DiskCacheTestWithCache::WriteData(disk_cache::Entry* entry, int index, int offset, net::IOBuffer* buf, int len, bool truncate) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = entry->WriteData(index, offset, buf, len, &cb, truncate); return cb.GetResult(rv); } @@ -163,7 +163,7 @@ int DiskCacheTestWithCache::WriteData(disk_cache::Entry* entry, int index, int DiskCacheTestWithCache::ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, int len) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = entry->ReadSparseData(offset, buf, len, &cb); return cb.GetResult(rv); } @@ -171,7 +171,7 @@ int DiskCacheTestWithCache::ReadSparseData(disk_cache::Entry* entry, int DiskCacheTestWithCache::WriteSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, int len) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = entry->WriteSparseData(offset, buf, len, &cb); return cb.GetResult(rv); } @@ -253,7 +253,7 @@ void DiskCacheTestWithCache::InitDiskCache() { use_current_thread_ ? base::MessageLoopProxy::current() : cache_thread_.message_loop_proxy(); - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = disk_cache::BackendImpl::CreateBackend( path, force_creation_, size_, type_, disk_cache::kNoRandom, thread, NULL, &cache_, &cb); @@ -280,7 +280,7 @@ void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) { cache_impl_->SetType(type_); cache_impl_->SetFlags(disk_cache::kNoRandom); - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = cache_impl_->Init(&cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); } diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc index 873a194..7bcccf4 100644 --- a/net/disk_cache/entry_impl.cc +++ b/net/disk_cache/entry_impl.cc @@ -33,7 +33,7 @@ class SyncCallback: public disk_cache::FileIOCallback { // |end_event_type| is the event type to log on completion. Logs nothing on // discard, or when the NetLog is not set to log all events. SyncCallback(disk_cache::EntryImpl* entry, net::IOBuffer* buffer, - net::CompletionCallback* callback, + net::OldCompletionCallback* callback, net::NetLog::EventType end_event_type) : entry_(entry), callback_(callback), buf_(buffer), start_(TimeTicks::Now()), end_event_type_(end_event_type) { @@ -47,7 +47,7 @@ class SyncCallback: public disk_cache::FileIOCallback { private: disk_cache::EntryImpl* entry_; - net::CompletionCallback* callback_; + net::OldCompletionCallback* callback_; scoped_refptr<net::IOBuffer> buf_; TimeTicks start_; const net::NetLog::EventType end_event_type_; @@ -309,7 +309,7 @@ void EntryImpl::DoomImpl() { } int EntryImpl::ReadDataImpl(int index, int offset, net::IOBuffer* buf, - int buf_len, CompletionCallback* callback) { + int buf_len, OldCompletionCallback* callback) { if (net_log_.IsLoggingAllEvents()) { net_log_.BeginEvent( net::NetLog::TYPE_ENTRY_READ_DATA, @@ -328,7 +328,7 @@ int EntryImpl::ReadDataImpl(int index, int offset, net::IOBuffer* buf, } int EntryImpl::WriteDataImpl(int index, int offset, net::IOBuffer* buf, - int buf_len, CompletionCallback* callback, + int buf_len, OldCompletionCallback* callback, bool truncate) { if (net_log_.IsLoggingAllEvents()) { net_log_.BeginEvent( @@ -349,7 +349,7 @@ int EntryImpl::WriteDataImpl(int index, int offset, net::IOBuffer* buf, } int EntryImpl::ReadSparseDataImpl(int64 offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(node_.Data()->dirty || read_only_); int result = InitSparseData(); if (net::OK != result) @@ -363,7 +363,7 @@ int EntryImpl::ReadSparseDataImpl(int64 offset, net::IOBuffer* buf, int buf_len, } int EntryImpl::WriteSparseDataImpl(int64 offset, net::IOBuffer* buf, - int buf_len, CompletionCallback* callback) { + int buf_len, OldCompletionCallback* callback) { DCHECK(node_.Data()->dirty || read_only_); int result = InitSparseData(); if (net::OK != result) @@ -391,7 +391,7 @@ void EntryImpl::CancelSparseIOImpl() { sparse_->CancelIO(); } -int EntryImpl::ReadyForSparseIOImpl(CompletionCallback* callback) { +int EntryImpl::ReadyForSparseIOImpl(OldCompletionCallback* callback) { DCHECK(sparse_.get()); return sparse_->ReadyToUse(callback); } @@ -791,7 +791,7 @@ int32 EntryImpl::GetDataSize(int index) const { } int EntryImpl::ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { if (!callback) return ReadDataImpl(index, offset, buf, buf_len, callback); @@ -812,7 +812,7 @@ int EntryImpl::ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, } int EntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback, bool truncate) { + OldCompletionCallback* callback, bool truncate) { if (!callback) return WriteDataImpl(index, offset, buf, buf_len, callback, truncate); @@ -829,7 +829,7 @@ int EntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, } int EntryImpl::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { if (!callback) return ReadSparseDataImpl(offset, buf, buf_len, callback); @@ -839,7 +839,7 @@ int EntryImpl::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, } int EntryImpl::WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { if (!callback) return WriteSparseDataImpl(offset, buf, buf_len, callback); @@ -849,7 +849,7 @@ int EntryImpl::WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, } int EntryImpl::GetAvailableRange(int64 offset, int len, int64* start, - CompletionCallback* callback) { + OldCompletionCallback* callback) { backend_->background_queue()->GetAvailableRange(this, offset, len, start, callback); return net::ERR_IO_PENDING; @@ -868,7 +868,7 @@ void EntryImpl::CancelSparseIO() { backend_->background_queue()->CancelSparseIO(this); } -int EntryImpl::ReadyForSparseIO(net::CompletionCallback* callback) { +int EntryImpl::ReadyForSparseIO(net::OldCompletionCallback* callback) { if (!sparse_.get()) return net::OK; @@ -929,7 +929,7 @@ EntryImpl::~EntryImpl() { // ------------------------------------------------------------------------ int EntryImpl::InternalReadData(int index, int offset, net::IOBuffer* buf, - int buf_len, CompletionCallback* callback) { + int buf_len, OldCompletionCallback* callback) { DCHECK(node_.Data()->dirty || read_only_); DVLOG(2) << "Read from " << index << " at " << offset << " : " << buf_len; if (index < 0 || index >= kNumStreams) @@ -999,7 +999,7 @@ int EntryImpl::InternalReadData(int index, int offset, net::IOBuffer* buf, } int EntryImpl::InternalWriteData(int index, int offset, net::IOBuffer* buf, - int buf_len, CompletionCallback* callback, + int buf_len, OldCompletionCallback* callback, bool truncate) { DCHECK(node_.Data()->dirty || read_only_); DVLOG(2) << "Write to " << index << " at " << offset << " : " << buf_len; diff --git a/net/disk_cache/entry_impl.h b/net/disk_cache/entry_impl.h index c0fb5e1..16657af 100644 --- a/net/disk_cache/entry_impl.h +++ b/net/disk_cache/entry_impl.h @@ -38,16 +38,16 @@ class NET_EXPORT_PRIVATE EntryImpl // Background implementation of the Entry interface. void DoomImpl(); int ReadDataImpl(int index, int offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback); + OldCompletionCallback* callback); int WriteDataImpl(int index, int offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback, bool truncate); + OldCompletionCallback* callback, bool truncate); int ReadSparseDataImpl(int64 offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback); + OldCompletionCallback* callback); int WriteSparseDataImpl(int64 offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback); + OldCompletionCallback* callback); int GetAvailableRangeImpl(int64 offset, int len, int64* start); void CancelSparseIOImpl(); - int ReadyForSparseIOImpl(CompletionCallback* callback); + int ReadyForSparseIOImpl(OldCompletionCallback* callback); inline CacheEntryBlock* entry() { return &entry_; @@ -145,19 +145,19 @@ class NET_EXPORT_PRIVATE EntryImpl virtual base::Time GetLastModified() const; virtual int32 GetDataSize(int index) const; virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* completion_callback); + net::OldCompletionCallback* completion_callback); virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* completion_callback, + net::OldCompletionCallback* completion_callback, bool truncate); virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* completion_callback); + net::OldCompletionCallback* completion_callback); virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* completion_callback); + net::OldCompletionCallback* completion_callback); virtual int GetAvailableRange(int64 offset, int len, int64* start, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual bool CouldBeSparse() const; virtual void CancelSparseIO(); - virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback); + virtual int ReadyForSparseIO(net::OldCompletionCallback* completion_callback); private: enum { @@ -170,9 +170,9 @@ class NET_EXPORT_PRIVATE EntryImpl // Do all the work for ReadDataImpl and WriteDataImpl. Implemented as // separate functions to make logging of results simpler. int InternalReadData(int index, int offset, net::IOBuffer* buf, - int buf_len, CompletionCallback* callback); + int buf_len, OldCompletionCallback* callback); int InternalWriteData(int index, int offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback, bool truncate); + OldCompletionCallback* callback, bool truncate); // Initializes the storage for an internal or external data block. bool CreateDataBlock(int index, int size); diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index 25cd66c..1374101 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc @@ -1141,7 +1141,7 @@ TEST_F(DiskCacheEntryTest, ReadWriteDestroyBuffer) { scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer->data(), kSize, false); - TestCompletionCallback cb; + TestOldCompletionCallback cb; EXPECT_EQ(net::ERR_IO_PENDING, entry->WriteData(0, 0, buffer, kSize, &cb, false)); @@ -1276,7 +1276,7 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyEnumerationWithSparseEntries) { // Writes |buf_1| to offset and reads it back as |buf_2|. void VerifySparseIO(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf_1, int size, net::IOBuffer* buf_2) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; memset(buf_2->data(), 0, size); int ret = entry->ReadSparseData(offset, buf_2, size, &cb); @@ -1295,7 +1295,7 @@ void VerifySparseIO(disk_cache::Entry* entry, int64 offset, // same as the content of the provided |buffer|. void VerifyContentSparseIO(disk_cache::Entry* entry, int64 offset, char* buffer, int size) { - TestCompletionCallback cb; + TestOldCompletionCallback cb; scoped_refptr<net::IOBuffer> buf_1(new net::IOBuffer(size)); memset(buf_1->data(), 0, size); @@ -1392,7 +1392,7 @@ void DiskCacheEntryTest::GetAvailableRange() { // We stop at the first empty block. int64 start; - TestCompletionCallback cb; + TestOldCompletionCallback cb; int rv = entry->GetAvailableRange(0x20F0000, kSize * 2, &start, &cb); EXPECT_EQ(kSize, cb.GetResult(rv)); EXPECT_EQ(0x20F0000, start); @@ -1538,7 +1538,7 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyMisalignedGetAvailableRange) { EXPECT_EQ(8192, entry->WriteSparseData(50000, buf, 8192, NULL)); int64 start; - TestCompletionCallback cb; + TestOldCompletionCallback cb; // Test that we stop at a discontinuous child at the second block. int rv = entry->GetAvailableRange(0, 10000, &start, &cb); EXPECT_EQ(1024, cb.GetResult(rv)); @@ -1685,22 +1685,22 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyDoomSparseEntry) { DoomSparseEntry(); } -// A CompletionCallback that deletes the cache from within the callback. The way -// a TestCompletionCallback works means that all tasks (even new ones) are +// 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 SparseTestCompletionCallback : public TestCompletionCallback { +class SparseTestOldCompletionCallback : public TestOldCompletionCallback { public: - explicit SparseTestCompletionCallback(disk_cache::Backend* cache) + explicit SparseTestOldCompletionCallback(disk_cache::Backend* cache) : cache_(cache) {} virtual void RunWithParams(const Tuple1<int>& params) { delete cache_; - TestCompletionCallback::RunWithParams(params); + TestOldCompletionCallback::RunWithParams(params); } private: disk_cache::Backend* cache_; - 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 @@ -1726,7 +1726,7 @@ TEST_F(DiskCacheEntryTest, DoomSparseEntry2) { EXPECT_EQ(9, cache_->GetEntryCount()); entry->Close(); - SparseTestCompletionCallback cb(cache_); + SparseTestOldCompletionCallback cb(cache_); int rv = cache_->DoomEntry(key, &cb); EXPECT_EQ(net::ERR_IO_PENDING, rv); EXPECT_EQ(net::OK, cb.WaitForResult()); @@ -1771,7 +1771,7 @@ void DiskCacheEntryTest::PartialSparseEntry() { int rv; int64 start; - TestCompletionCallback cb; + TestOldCompletionCallback cb; if (memory_only_) { rv = entry->GetAvailableRange(0, 600, &start, &cb); EXPECT_EQ(100, cb.GetResult(rv)); @@ -1893,7 +1893,7 @@ TEST_F(DiskCacheEntryTest, CancelSparseIO) { CacheTestFillBuffer(buf->data(), kSize, false); // This will open and write two "real" entries. - TestCompletionCallback cb1, cb2, cb3, cb4, cb5; + TestOldCompletionCallback cb1, cb2, cb3, cb4, cb5; int rv = entry->WriteSparseData(1024 * 1024 - 4096, buf, kSize, &cb1); EXPECT_EQ(net::ERR_IO_PENDING, rv); diff --git a/net/disk_cache/in_flight_backend_io.cc b/net/disk_cache/in_flight_backend_io.cc index 259d888..ea84561 100644 --- a/net/disk_cache/in_flight_backend_io.cc +++ b/net/disk_cache/in_flight_backend_io.cc @@ -14,7 +14,7 @@ namespace disk_cache { BackendIO::BackendIO(InFlightIO* controller, BackendImpl* backend, - net::CompletionCallback* callback) + net::OldCompletionCallback* callback) : BackgroundIO(controller), backend_(backend), callback_(callback), operation_(OP_NONE), ALLOW_THIS_IN_INITIALIZER_LIST( @@ -299,34 +299,34 @@ InFlightBackendIO::InFlightBackendIO(BackendImpl* backend, InFlightBackendIO::~InFlightBackendIO() { } -void InFlightBackendIO::Init(CompletionCallback* callback) { +void InFlightBackendIO::Init(OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->Init(); PostOperation(operation); } void InFlightBackendIO::OpenEntry(const std::string& key, Entry** entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->OpenEntry(key, entry); PostOperation(operation); } void InFlightBackendIO::CreateEntry(const std::string& key, Entry** entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->CreateEntry(key, entry); PostOperation(operation); } void InFlightBackendIO::DoomEntry(const std::string& key, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->DoomEntry(key); PostOperation(operation); } -void InFlightBackendIO::DoomAllEntries(CompletionCallback* callback) { +void InFlightBackendIO::DoomAllEntries(OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->DoomAllEntries(); PostOperation(operation); @@ -334,28 +334,28 @@ void InFlightBackendIO::DoomAllEntries(CompletionCallback* callback) { void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->DoomEntriesBetween(initial_time, end_time); PostOperation(operation); } void InFlightBackendIO::DoomEntriesSince(const base::Time initial_time, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->DoomEntriesSince(initial_time); PostOperation(operation); } void InFlightBackendIO::OpenNextEntry(void** iter, Entry** next_entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->OpenNextEntry(iter, next_entry); PostOperation(operation); } void InFlightBackendIO::OpenPrevEntry(void** iter, Entry** prev_entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->OpenPrevEntry(iter, prev_entry); PostOperation(operation); @@ -385,13 +385,13 @@ void InFlightBackendIO::DoomEntryImpl(EntryImpl* entry) { PostOperation(operation); } -void InFlightBackendIO::FlushQueue(net::CompletionCallback* callback) { +void InFlightBackendIO::FlushQueue(net::OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->FlushQueue(); PostOperation(operation); } -void InFlightBackendIO::RunTask(Task* task, net::CompletionCallback* callback) { +void InFlightBackendIO::RunTask(Task* task, net::OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->RunTask(task); PostOperation(operation); @@ -399,7 +399,7 @@ void InFlightBackendIO::RunTask(Task* task, net::CompletionCallback* callback) { void InFlightBackendIO::ReadData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->ReadData(entry, index, offset, buf, buf_len); PostOperation(operation); @@ -408,7 +408,7 @@ void InFlightBackendIO::ReadData(EntryImpl* entry, int index, int offset, void InFlightBackendIO::WriteData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, int buf_len, bool truncate, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->WriteData(entry, index, offset, buf, buf_len, truncate); PostOperation(operation); @@ -416,7 +416,7 @@ void InFlightBackendIO::WriteData(EntryImpl* entry, int index, int offset, void InFlightBackendIO::ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->ReadSparseData(entry, offset, buf, buf_len); PostOperation(operation); @@ -424,7 +424,7 @@ void InFlightBackendIO::ReadSparseData(EntryImpl* entry, int64 offset, void InFlightBackendIO::WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->WriteSparseData(entry, offset, buf, buf_len); PostOperation(operation); @@ -432,7 +432,7 @@ void InFlightBackendIO::WriteSparseData(EntryImpl* entry, int64 offset, void InFlightBackendIO::GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->GetAvailableRange(entry, offset, len, start); PostOperation(operation); @@ -445,7 +445,7 @@ void InFlightBackendIO::CancelSparseIO(EntryImpl* entry) { } void InFlightBackendIO::ReadyForSparseIO(EntryImpl* entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->ReadyForSparseIO(entry); PostOperation(operation); diff --git a/net/disk_cache/in_flight_backend_io.h b/net/disk_cache/in_flight_backend_io.h index f90c286..71ffa38 100644 --- a/net/disk_cache/in_flight_backend_io.h +++ b/net/disk_cache/in_flight_backend_io.h @@ -26,7 +26,7 @@ class EntryImpl; class BackendIO : public BackgroundIO { public: BackendIO(InFlightIO* controller, BackendImpl* backend, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); // Runs the actual operation on the background thread. void ExecuteOperation(); @@ -37,7 +37,7 @@ class BackendIO : public BackgroundIO { // Returns true if this operation is directed to an entry (vs. the backend). bool IsEntryOperation(); - net::CompletionCallback* callback() { return callback_; } + net::OldCompletionCallback* callback() { return callback_; } // Grabs an extra reference of entry_. void ReferenceEntry(); @@ -113,9 +113,9 @@ class BackendIO : public BackgroundIO { void ExecuteEntryOperation(); BackendImpl* backend_; - net::CompletionCallback* callback_; + net::OldCompletionCallback* callback_; Operation operation_; - net::CompletionCallbackImpl<BackendIO> my_callback_; + net::OldCompletionCallbackImpl<BackendIO> my_callback_; // The arguments of all the operations we proxy: std::string key_; @@ -146,40 +146,40 @@ class InFlightBackendIO : public InFlightIO { virtual ~InFlightBackendIO(); // The operations we proxy: - void Init(net::CompletionCallback* callback); + void Init(net::OldCompletionCallback* callback); void OpenEntry(const std::string& key, Entry** entry, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); void CreateEntry(const std::string& key, Entry** entry, - net::CompletionCallback* callback); - void DoomEntry(const std::string& key, net::CompletionCallback* callback); - void DoomAllEntries(net::CompletionCallback* callback); + net::OldCompletionCallback* callback); + void DoomEntry(const std::string& key, net::OldCompletionCallback* callback); + void DoomAllEntries(net::OldCompletionCallback* callback); void DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); void DoomEntriesSince(const base::Time initial_time, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); void OpenNextEntry(void** iter, Entry** next_entry, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); void OpenPrevEntry(void** iter, Entry** prev_entry, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); void EndEnumeration(void* iterator); void OnExternalCacheHit(const std::string& key); void CloseEntryImpl(EntryImpl* entry); void DoomEntryImpl(EntryImpl* entry); - void FlushQueue(net::CompletionCallback* callback); - void RunTask(Task* task, net::CompletionCallback* callback); + void FlushQueue(net::OldCompletionCallback* callback); + void RunTask(Task* task, net::OldCompletionCallback* callback); void ReadData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, - int buf_len, net::CompletionCallback* callback); + int buf_len, net::OldCompletionCallback* callback); void WriteData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, - int buf_len, bool truncate, net::CompletionCallback* callback); + int buf_len, bool truncate, net::OldCompletionCallback* callback); void ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, - int buf_len, net::CompletionCallback* callback); + int buf_len, net::OldCompletionCallback* callback); void WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, - int buf_len, net::CompletionCallback* callback); + int buf_len, net::OldCompletionCallback* callback); void GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); void CancelSparseIO(EntryImpl* entry); - void ReadyForSparseIO(EntryImpl* entry, net::CompletionCallback* callback); + void ReadyForSparseIO(EntryImpl* entry, net::OldCompletionCallback* callback); // Blocks until all operations are cancelled or completed. void WaitForPendingIO(); diff --git a/net/disk_cache/mem_backend_impl.cc b/net/disk_cache/mem_backend_impl.cc index 2f7713b..f08b316 100644 --- a/net/disk_cache/mem_backend_impl.cc +++ b/net/disk_cache/mem_backend_impl.cc @@ -129,7 +129,7 @@ int32 MemBackendImpl::GetEntryCount() const { } int MemBackendImpl::OpenEntry(const std::string& key, Entry** entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { if (OpenEntry(key, entry)) return net::OK; @@ -137,7 +137,7 @@ int MemBackendImpl::OpenEntry(const std::string& key, Entry** entry, } int MemBackendImpl::CreateEntry(const std::string& key, Entry** entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { if (CreateEntry(key, entry)) return net::OK; @@ -145,14 +145,14 @@ int MemBackendImpl::CreateEntry(const std::string& key, Entry** entry, } int MemBackendImpl::DoomEntry(const std::string& key, - CompletionCallback* callback) { + OldCompletionCallback* callback) { if (DoomEntry(key)) return net::OK; return net::ERR_FAILED; } -int MemBackendImpl::DoomAllEntries(CompletionCallback* callback) { +int MemBackendImpl::DoomAllEntries(OldCompletionCallback* callback) { if (DoomAllEntries()) return net::OK; @@ -161,7 +161,7 @@ int MemBackendImpl::DoomAllEntries(CompletionCallback* callback) { int MemBackendImpl::DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - CompletionCallback* callback) { + OldCompletionCallback* callback) { if (DoomEntriesBetween(initial_time, end_time)) return net::OK; @@ -169,7 +169,7 @@ int MemBackendImpl::DoomEntriesBetween(const base::Time initial_time, } int MemBackendImpl::DoomEntriesSince(const base::Time initial_time, - CompletionCallback* callback) { + OldCompletionCallback* callback) { if (DoomEntriesSince(initial_time)) return net::OK; @@ -177,7 +177,7 @@ int MemBackendImpl::DoomEntriesSince(const base::Time initial_time, } int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry, - CompletionCallback* callback) { + OldCompletionCallback* callback) { if (OpenNextEntry(iter, next_entry)) return net::OK; diff --git a/net/disk_cache/mem_backend_impl.h b/net/disk_cache/mem_backend_impl.h index 68e4508..239d7e0 100644 --- a/net/disk_cache/mem_backend_impl.h +++ b/net/disk_cache/mem_backend_impl.h @@ -65,18 +65,18 @@ class NET_EXPORT_PRIVATE MemBackendImpl : public Backend { // Backend interface. virtual int32 GetEntryCount() const; virtual int OpenEntry(const std::string& key, Entry** entry, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual int CreateEntry(const std::string& key, Entry** entry, - CompletionCallback* callback); - virtual int DoomEntry(const std::string& key, CompletionCallback* callback); - virtual int DoomAllEntries(CompletionCallback* callback); + OldCompletionCallback* callback); + virtual int DoomEntry(const std::string& key, OldCompletionCallback* callback); + virtual int DoomAllEntries(OldCompletionCallback* callback); virtual int DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual int DoomEntriesSince(const base::Time initial_time, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual int OpenNextEntry(void** iter, Entry** next_entry, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual void EndEnumeration(void** iter); virtual void GetStats( std::vector<std::pair<std::string, std::string> >* stats) {} diff --git a/net/disk_cache/mem_entry_impl.cc b/net/disk_cache/mem_entry_impl.cc index f1267ce..677cd6a 100644 --- a/net/disk_cache/mem_entry_impl.cc +++ b/net/disk_cache/mem_entry_impl.cc @@ -167,7 +167,7 @@ int32 MemEntryImpl::GetDataSize(int index) const { } int MemEntryImpl::ReadData(int index, int offset, net::IOBuffer* buf, - int buf_len, net::CompletionCallback* completion_callback) { + int buf_len, net::OldCompletionCallback* completion_callback) { if (net_log_.IsLoggingAllEvents()) { net_log_.BeginEvent( net::NetLog::TYPE_ENTRY_READ_DATA, @@ -186,7 +186,7 @@ int MemEntryImpl::ReadData(int index, int offset, net::IOBuffer* buf, } int MemEntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, - int buf_len, net::CompletionCallback* completion_callback, bool truncate) { + int buf_len, net::OldCompletionCallback* completion_callback, bool truncate) { if (net_log_.IsLoggingAllEvents()) { net_log_.BeginEvent( net::NetLog::TYPE_ENTRY_WRITE_DATA, @@ -205,7 +205,7 @@ int MemEntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, } int MemEntryImpl::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* completion_callback) { + net::OldCompletionCallback* completion_callback) { if (net_log_.IsLoggingAllEvents()) { net_log_.BeginEvent( net::NetLog::TYPE_SPARSE_READ, @@ -219,7 +219,7 @@ int MemEntryImpl::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, } int MemEntryImpl::WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* completion_callback) { + net::OldCompletionCallback* completion_callback) { if (net_log_.IsLoggingAllEvents()) { net_log_.BeginEvent(net::NetLog::TYPE_SPARSE_WRITE, make_scoped_refptr( @@ -232,7 +232,7 @@ int MemEntryImpl::WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, } int MemEntryImpl::GetAvailableRange(int64 offset, int len, int64* start, - CompletionCallback* callback) { + OldCompletionCallback* callback) { if (net_log_.IsLoggingAllEvents()) { net_log_.BeginEvent( net::NetLog::TYPE_SPARSE_GET_RANGE, @@ -255,7 +255,7 @@ bool MemEntryImpl::CouldBeSparse() const { } int MemEntryImpl::ReadyForSparseIO( - net::CompletionCallback* completion_callback) { + net::OldCompletionCallback* completion_callback) { return net::OK; } diff --git a/net/disk_cache/mem_entry_impl.h b/net/disk_cache/mem_entry_impl.h index db46c4d..7c4efc4 100644 --- a/net/disk_cache/mem_entry_impl.h +++ b/net/disk_cache/mem_entry_impl.h @@ -99,19 +99,19 @@ class MemEntryImpl : public Entry { virtual base::Time GetLastModified() const; virtual int32 GetDataSize(int index) const; virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* completion_callback); + net::OldCompletionCallback* completion_callback); virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* completion_callback, + net::OldCompletionCallback* completion_callback, bool truncate); virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* completion_callback); + net::OldCompletionCallback* completion_callback); virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - net::CompletionCallback* completion_callback); + net::OldCompletionCallback* completion_callback); virtual int GetAvailableRange(int64 offset, int len, int64* start, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual bool CouldBeSparse() const; virtual void CancelSparseIO() {} - virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback); + virtual int ReadyForSparseIO(net::OldCompletionCallback* completion_callback); private: typedef base::hash_map<int, MemEntryImpl*> EntryMap; diff --git a/net/disk_cache/sparse_control.cc b/net/disk_cache/sparse_control.cc index 3043d2b..af94f98 100644 --- a/net/disk_cache/sparse_control.cc +++ b/net/disk_cache/sparse_control.cc @@ -233,7 +233,7 @@ bool SparseControl::CouldBeSparse() const { } int SparseControl::StartIO(SparseOperation op, int64 offset, net::IOBuffer* buf, - int buf_len, net::CompletionCallback* callback) { + int buf_len, net::OldCompletionCallback* callback) { DCHECK(init_); // We don't support simultaneous IO for sparse data. if (operation_ != kNoOperation) @@ -308,7 +308,7 @@ void SparseControl::CancelIO() { abort_ = true; } -int SparseControl::ReadyToUse(net::CompletionCallback* completion_callback) { +int SparseControl::ReadyToUse(net::OldCompletionCallback* completion_callback) { if (!abort_) return net::OK; @@ -690,7 +690,7 @@ bool SparseControl::DoChildIO() { // We have more work to do. Let's not trigger a callback to the caller. finished_ = false; - net::CompletionCallback* callback = user_callback_ ? &child_callback_ : NULL; + net::OldCompletionCallback* callback = user_callback_ ? &child_callback_ : NULL; int rv = 0; switch (operation_) { @@ -836,7 +836,7 @@ void SparseControl::OnChildIOCompleted(int result) { void SparseControl::DoUserCallback() { DCHECK(user_callback_); - net::CompletionCallback* c = user_callback_; + net::OldCompletionCallback* c = user_callback_; user_callback_ = NULL; user_buf_ = NULL; pending_ = false; @@ -850,7 +850,7 @@ void SparseControl::DoAbortCallbacks() { for (size_t i = 0; i < abort_callbacks_.size(); i++) { // Releasing all references to entry_ may result in the destruction of this // object so we should not be touching it after the last Release(). - net::CompletionCallback* c = abort_callbacks_[i]; + net::OldCompletionCallback* c = abort_callbacks_[i]; if (i == abort_callbacks_.size() - 1) abort_callbacks_.clear(); diff --git a/net/disk_cache/sparse_control.h b/net/disk_cache/sparse_control.h index 15704df..98829bd 100644 --- a/net/disk_cache/sparse_control.h +++ b/net/disk_cache/sparse_control.h @@ -59,7 +59,7 @@ class SparseControl { // WriteSparseData for details about the arguments. The return value is the // number of bytes read or written, or a net error code. int StartIO(SparseOperation op, int64 offset, net::IOBuffer* buf, - int buf_len, net::CompletionCallback* callback); + int buf_len, net::OldCompletionCallback* callback); // Implements Entry::GetAvailableRange(). int GetAvailableRange(int64 offset, int len, int64* start); @@ -70,7 +70,7 @@ class SparseControl { // Returns OK if the entry can be used for new IO or ERR_IO_PENDING if we are // busy. If the entry is busy, we'll invoke the callback when we are ready // again. See disk_cache::Entry::ReadyToUse() for more info. - int ReadyToUse(net::CompletionCallback* completion_callback); + int ReadyToUse(net::OldCompletionCallback* completion_callback); // Deletes the children entries of |entry|. static void DeleteChildren(EntryImpl* entry); @@ -159,9 +159,9 @@ class SparseControl { SparseData child_data_; // Parent and allocation map of child_. Bitmap child_map_; // The allocation map as a bitmap. - net::CompletionCallbackImpl<SparseControl> child_callback_; - net::CompletionCallback* user_callback_; - std::vector<net::CompletionCallback*> abort_callbacks_; + net::OldCompletionCallbackImpl<SparseControl> child_callback_; + net::OldCompletionCallback* user_callback_; + std::vector<net::OldCompletionCallback*> abort_callbacks_; int64 offset_; // Current sparse offset. scoped_refptr<net::DrainableIOBuffer> user_buf_; int buf_len_; // Bytes to read or write. diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc index 0cd8f43..7fad2ef 100644 --- a/net/disk_cache/stress_cache.cc +++ b/net/disk_cache/stress_cache.cc @@ -99,7 +99,7 @@ void StressTheCache(int iteration) { base::Thread::Options(MessageLoop::TYPE_IO, 0))) return; - TestCompletionCallback cb; + TestOldCompletionCallback cb; disk_cache::Backend* cache; int rv = disk_cache::BackendImpl::CreateBackend( path, false, cache_size, net::DISK_CACHE, |
