diff options
-rw-r--r-- | chrome/browser/browsing_data_remover.cc | 10 | ||||
-rw-r--r-- | net/disk_cache/backend_impl.cc | 21 | ||||
-rw-r--r-- | net/disk_cache/backend_impl.h | 28 | ||||
-rw-r--r-- | net/disk_cache/disk_cache.h | 6 | ||||
-rw-r--r-- | net/disk_cache/disk_cache_test_base.cc | 13 | ||||
-rw-r--r-- | net/disk_cache/in_flight_backend_io.cc | 21 | ||||
-rw-r--r-- | net/disk_cache/in_flight_backend_io.h | 6 | ||||
-rw-r--r-- | net/disk_cache/mem_backend_impl.cc | 24 | ||||
-rw-r--r-- | net/disk_cache/mem_backend_impl.h | 6 | ||||
-rw-r--r-- | net/http/mock_http_cache.cc | 15 | ||||
-rw-r--r-- | net/http/mock_http_cache.h | 6 | ||||
-rw-r--r-- | net/tools/dump_cache/upgrade.cc | 8 | ||||
-rw-r--r-- | net/url_request/view_cache_helper.cc | 6 |
13 files changed, 34 insertions, 136 deletions
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc index d708cd9..2d32fc8 100644 --- a/chrome/browser/browsing_data_remover.cc +++ b/chrome/browser/browsing_data_remover.cc @@ -478,10 +478,14 @@ void BrowsingDataRemover::DoClearCache(int rv) { // |cache_| can be null if it cannot be initialized. if (cache_) { if (delete_begin_.is_null()) { - rv = cache_->DoomAllEntries(&cache_callback_); + rv = cache_->DoomAllEntries( + base::Bind(&BrowsingDataRemover::DoClearCache, + base::Unretained(this))); } else { - rv = cache_->DoomEntriesBetween(delete_begin_, delete_end_, - &cache_callback_); + rv = cache_->DoomEntriesBetween( + delete_begin_, delete_end_, + base::Bind(&BrowsingDataRemover::DoClearCache, + base::Unretained(this))); } cache_ = NULL; } diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 1443f7f..2cc2f3a 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -1395,12 +1395,6 @@ int BackendImpl::DoomEntry(const std::string& key, return net::ERR_IO_PENDING; } -int BackendImpl::DoomAllEntries(OldCompletionCallback* callback) { - DCHECK(callback); - background_queue_.DoomAllEntries(callback); - return net::ERR_IO_PENDING; -} - int BackendImpl::DoomAllEntries(const net::CompletionCallback& callback) { DCHECK(!callback.is_null()); background_queue_.DoomAllEntries(callback); @@ -1409,14 +1403,6 @@ int BackendImpl::DoomAllEntries(const net::CompletionCallback& callback) { int BackendImpl::DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - OldCompletionCallback* callback) { - DCHECK(callback); - background_queue_.DoomEntriesBetween(initial_time, end_time, callback); - return net::ERR_IO_PENDING; -} - -int BackendImpl::DoomEntriesBetween(const base::Time initial_time, - const base::Time end_time, const net::CompletionCallback& callback) { DCHECK(!callback.is_null()); background_queue_.DoomEntriesBetween(initial_time, end_time, callback); @@ -1431,13 +1417,6 @@ int BackendImpl::DoomEntriesSince(const base::Time initial_time, } int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry, - OldCompletionCallback* callback) { - DCHECK(callback); - background_queue_.OpenNextEntry(iter, next_entry, callback); - return net::ERR_IO_PENDING; -} - -int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry, const net::CompletionCallback& callback) { DCHECK(!callback.is_null()); background_queue_.OpenNextEntry(iter, next_entry, callback); diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h index 3563fde..6c76c2c 100644 --- a/net/disk_cache/backend_impl.h +++ b/net/disk_cache/backend_impl.h @@ -65,7 +65,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { int SyncInit(); void CleanupCache(); - // Same bahavior as OpenNextEntry but walks the list from back to front. + // Same behavior as OpenNextEntry but walks the list from back to front. int OpenPrevEntry(void** iter, Entry** prev_entry, OldCompletionCallback* callback); @@ -115,7 +115,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { // the related storage in addition of releasing the related block. void DeleteBlock(Addr block_address, bool deep); - // Retrieves a pointer to the lru-related data. + // Retrieves a pointer to the LRU-related data. LruData* GetLruData(); // Updates the ranking information for an entry. @@ -211,7 +211,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { // Called when an interesting event should be logged (counted). void OnEvent(Stats::Counters an_event); - // Keeps track of paylod access (doesn't include metadata). + // Keeps track of payload access (doesn't include metadata). void OnRead(int bytes); void OnWrite(int bytes); @@ -252,11 +252,11 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { // entries. This method should be called directly on the cache thread. void TrimDeletedListForTest(bool empty); - // Peforms a simple self-check, and returns the number of dirty items + // Performs a simple self-check, and returns the number of dirty items // or an error code (negative value). int SelfCheck(); - // Backend interface. + // Backend implementation. virtual int32 GetEntryCount() const OVERRIDE; virtual int OpenEntry(const std::string& key, Entry** entry, OldCompletionCallback* callback) OVERRIDE; @@ -264,11 +264,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { OldCompletionCallback* callback) OVERRIDE; virtual int DoomEntry(const std::string& key, OldCompletionCallback* callback) OVERRIDE; - virtual int DoomAllEntries(OldCompletionCallback* callback) OVERRIDE; virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE; - virtual int DoomEntriesBetween(const base::Time initial_time, - const base::Time end_time, - OldCompletionCallback* callback) OVERRIDE; virtual int DoomEntriesBetween( const base::Time initial_time, const base::Time end_time, @@ -276,8 +272,6 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { virtual int DoomEntriesSince(const base::Time initial_time, OldCompletionCallback* callback) OVERRIDE; virtual int OpenNextEntry(void** iter, Entry** next_entry, - OldCompletionCallback* callback) OVERRIDE; - virtual int OpenNextEntry(void** iter, Entry** next_entry, const net::CompletionCallback& callback) OVERRIDE; virtual void EndEnumeration(void** iter) OVERRIDE; virtual void GetStats(StatsItems* stats) OVERRIDE; @@ -312,7 +306,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { // Opens the next or previous entry on a cache iteration. EntryImpl* OpenFollowingEntry(bool forward, void** iter); - // Opens the next or previous entry on a single list. If successfull, + // Opens the next or previous entry on a single list. If successful, // |from_entry| will be updated to point to the new entry, otherwise it will // be set to NULL; in other words, it is used as an explicit iterator. bool OpenFollowingEntryFromList(bool forward, Rankings::List list, @@ -349,7 +343,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { // Performs basic checks on the index file. Returns false on failure. bool CheckIndex(); - // Part of the selt test. Returns the number or dirty entries, or an error. + // Part of the self test. Returns the number or dirty entries, or an error. int CheckAllEntries(); // Part of the self test. Returns false if the entry is corrupt. @@ -376,7 +370,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { int buffer_bytes_; // Total size of the temporary entries' buffers. int up_ticks_; // The number of timer ticks received (OnStatsTimer). net::CacheType cache_type_; - int uma_report_; // Controls transmision of UMA data. + int uma_report_; // Controls transmission of UMA data. uint32 user_flags_; // Flags set by the user. bool init_; // controls the initialization of the system. bool restarted_; @@ -389,16 +383,16 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend { net::NetLog* net_log_; - Stats stats_; // Usage statistcs. + Stats stats_; // Usage statistics. base::RepeatingTimer<BackendImpl> timer_; // Usage timer. base::WaitableEvent done_; // Signals the end of background work. - scoped_refptr<TraceObject> trace_object_; // Inits internal tracing. + scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. base::WeakPtrFactory<BackendImpl> ptr_factory_; DISALLOW_COPY_AND_ASSIGN(BackendImpl); }; -// Returns the prefered max cache size given the available disk space. +// Returns the preferred max cache size given the available disk space. NET_EXPORT_PRIVATE int PreferedCacheSize(int64 available); } // namespace disk_cache diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h index 3f52e23..a678eec 100644 --- a/net/disk_cache/disk_cache.h +++ b/net/disk_cache/disk_cache.h @@ -97,7 +97,6 @@ class NET_EXPORT Backend { // 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(OldCompletionCallback* callback) = 0; virtual int DoomAllEntries(const net::CompletionCallback& callback) = 0; // Marks a range of entries for deletion. This supports unbounded deletes in @@ -106,9 +105,6 @@ 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, - OldCompletionCallback* callback) = 0; - virtual int DoomEntriesBetween(const base::Time initial_time, - const base::Time end_time, const net::CompletionCallback& callback) = 0; // Marks all entries accessed since |initial_time| for deletion. The return @@ -130,8 +126,6 @@ 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, - OldCompletionCallback* callback) = 0; - virtual int OpenNextEntry(void** iter, Entry** next_entry, const net::CompletionCallback& callback) = 0; // Releases iter without returning the next entry. Whenever OpenNextEntry() diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc index ec5f67c..fef178e 100644 --- a/net/disk_cache/disk_cache_test_base.cc +++ b/net/disk_cache/disk_cache_test_base.cc @@ -125,15 +125,15 @@ int DiskCacheTestWithCache::DoomEntry(const std::string& key) { } int DiskCacheTestWithCache::DoomAllEntries() { - TestOldCompletionCallback cb; - int rv = cache_->DoomAllEntries(&cb); + net::TestCompletionCallback cb; + int rv = cache_->DoomAllEntries(cb.callback()); return cb.GetResult(rv); } int DiskCacheTestWithCache::DoomEntriesBetween(const base::Time initial_time, const base::Time end_time) { - TestOldCompletionCallback cb; - int rv = cache_->DoomEntriesBetween(initial_time, end_time, &cb); + net::TestCompletionCallback cb; + int rv = cache_->DoomEntriesBetween(initial_time, end_time, cb.callback()); return cb.GetResult(rv); } @@ -145,8 +145,8 @@ int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) { int DiskCacheTestWithCache::OpenNextEntry(void** iter, disk_cache::Entry** next_entry) { - TestOldCompletionCallback cb; - int rv = cache_->OpenNextEntry(iter, next_entry, &cb); + net::TestCompletionCallback cb; + int rv = cache_->OpenNextEntry(iter, next_entry, cb.callback()); return cb.GetResult(rv); } @@ -178,7 +178,6 @@ int DiskCacheTestWithCache::ReadData(disk_cache::Entry* entry, int index, return cb.GetResult(rv); } - int DiskCacheTestWithCache::WriteData(disk_cache::Entry* entry, int index, int offset, net::IOBuffer* buf, int len, bool truncate) { diff --git a/net/disk_cache/in_flight_backend_io.cc b/net/disk_cache/in_flight_backend_io.cc index 868ceed..5cc6a65 100644 --- a/net/disk_cache/in_flight_backend_io.cc +++ b/net/disk_cache/in_flight_backend_io.cc @@ -341,12 +341,6 @@ void InFlightBackendIO::DoomEntry(const std::string& key, PostOperation(operation); } -void InFlightBackendIO::DoomAllEntries(OldCompletionCallback* callback) { - scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); - operation->DoomAllEntries(); - PostOperation(operation); -} - void InFlightBackendIO::DoomAllEntries( const net::CompletionCallback& callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); @@ -356,14 +350,6 @@ void InFlightBackendIO::DoomAllEntries( void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - OldCompletionCallback* callback) { - scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); - operation->DoomEntriesBetween(initial_time, end_time); - PostOperation(operation); -} - -void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time, - const base::Time end_time, const net::CompletionCallback& callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->DoomEntriesBetween(initial_time, end_time); @@ -378,13 +364,6 @@ void InFlightBackendIO::DoomEntriesSince(const base::Time initial_time, } void InFlightBackendIO::OpenNextEntry(void** iter, Entry** next_entry, - OldCompletionCallback* callback) { - scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); - operation->OpenNextEntry(iter, next_entry); - PostOperation(operation); -} - -void InFlightBackendIO::OpenNextEntry(void** iter, Entry** next_entry, const net::CompletionCallback& callback) { scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->OpenNextEntry(iter, next_entry); diff --git a/net/disk_cache/in_flight_backend_io.h b/net/disk_cache/in_flight_backend_io.h index aa6979c..8d4024a 100644 --- a/net/disk_cache/in_flight_backend_io.h +++ b/net/disk_cache/in_flight_backend_io.h @@ -156,19 +156,13 @@ class InFlightBackendIO : public InFlightIO { void CreateEntry(const std::string& key, Entry** entry, net::OldCompletionCallback* callback); void DoomEntry(const std::string& key, net::OldCompletionCallback* callback); - void DoomAllEntries(net::OldCompletionCallback* callback); void DoomAllEntries(const net::CompletionCallback& callback); void DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - net::OldCompletionCallback* callback); - void DoomEntriesBetween(const base::Time initial_time, - const base::Time end_time, const net::CompletionCallback& callback); void DoomEntriesSince(const base::Time initial_time, net::OldCompletionCallback* callback); void OpenNextEntry(void** iter, Entry** next_entry, - net::OldCompletionCallback* callback); - void OpenNextEntry(void** iter, Entry** next_entry, const net::CompletionCallback& callback); void OpenPrevEntry(void** iter, Entry** prev_entry, net::OldCompletionCallback* callback); diff --git a/net/disk_cache/mem_backend_impl.cc b/net/disk_cache/mem_backend_impl.cc index a5165ed..bd07af2 100644 --- a/net/disk_cache/mem_backend_impl.cc +++ b/net/disk_cache/mem_backend_impl.cc @@ -152,13 +152,6 @@ int MemBackendImpl::DoomEntry(const std::string& key, return net::ERR_FAILED; } -int MemBackendImpl::DoomAllEntries(OldCompletionCallback* callback) { - if (DoomAllEntries()) - return net::OK; - - return net::ERR_FAILED; -} - int MemBackendImpl::DoomAllEntries(const net::CompletionCallback& callback) { if (DoomAllEntries()) return net::OK; @@ -166,15 +159,6 @@ int MemBackendImpl::DoomAllEntries(const net::CompletionCallback& callback) { return net::ERR_FAILED; } -int MemBackendImpl::DoomEntriesBetween(const base::Time initial_time, - const base::Time end_time, - OldCompletionCallback* callback) { - if (DoomEntriesBetween(initial_time, end_time)) - return net::OK; - - return net::ERR_FAILED; -} - int MemBackendImpl::DoomEntriesBetween( const base::Time initial_time, const base::Time end_time, const net::CompletionCallback& callback) { @@ -193,14 +177,6 @@ int MemBackendImpl::DoomEntriesSince(const base::Time initial_time, } int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry, - OldCompletionCallback* callback) { - if (OpenNextEntry(iter, next_entry)) - return net::OK; - - return net::ERR_FAILED; -} - -int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry, const net::CompletionCallback& 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 da94425..8793cec 100644 --- a/net/disk_cache/mem_backend_impl.h +++ b/net/disk_cache/mem_backend_impl.h @@ -70,11 +70,7 @@ class NET_EXPORT_PRIVATE MemBackendImpl : public Backend { OldCompletionCallback* callback) OVERRIDE; virtual int DoomEntry(const std::string& key, OldCompletionCallback* callback) OVERRIDE; - virtual int DoomAllEntries(OldCompletionCallback* callback) OVERRIDE; virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE; - virtual int DoomEntriesBetween(const base::Time initial_time, - const base::Time end_time, - OldCompletionCallback* callback) OVERRIDE; virtual int DoomEntriesBetween( const base::Time initial_time, const base::Time end_time, @@ -82,8 +78,6 @@ class NET_EXPORT_PRIVATE MemBackendImpl : public Backend { virtual int DoomEntriesSince(const base::Time initial_time, OldCompletionCallback* callback) OVERRIDE; virtual int OpenNextEntry(void** iter, Entry** next_entry, - OldCompletionCallback* callback) OVERRIDE; - virtual int OpenNextEntry(void** iter, Entry** next_entry, const net::CompletionCallback& callback) OVERRIDE; virtual void EndEnumeration(void** iter) OVERRIDE; virtual void GetStats( diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc index 19c6154..5fe148e 100644 --- a/net/http/mock_http_cache.cc +++ b/net/http/mock_http_cache.cc @@ -438,22 +438,12 @@ int MockDiskCache::DoomEntry(const std::string& key, return net::ERR_IO_PENDING; } -int MockDiskCache::DoomAllEntries(net::OldCompletionCallback* callback) { - return net::ERR_NOT_IMPLEMENTED; -} - int MockDiskCache::DoomAllEntries(const net::CompletionCallback& callback) { return net::ERR_NOT_IMPLEMENTED; } int MockDiskCache::DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, - net::OldCompletionCallback* callback) { - return net::ERR_NOT_IMPLEMENTED; -} - -int MockDiskCache::DoomEntriesBetween(const base::Time initial_time, - const base::Time end_time, const net::CompletionCallback& callback) { return net::ERR_NOT_IMPLEMENTED; } @@ -464,11 +454,6 @@ int MockDiskCache::DoomEntriesSince(const base::Time initial_time, } int MockDiskCache::OpenNextEntry(void** iter, disk_cache::Entry** next_entry, - net::OldCompletionCallback* callback) { - return net::ERR_NOT_IMPLEMENTED; -} - -int MockDiskCache::OpenNextEntry(void** iter, disk_cache::Entry** next_entry, const net::CompletionCallback& callback) { return net::ERR_NOT_IMPLEMENTED; } diff --git a/net/http/mock_http_cache.h b/net/http/mock_http_cache.h index 3305a51..8e492a9 100644 --- a/net/http/mock_http_cache.h +++ b/net/http/mock_http_cache.h @@ -102,11 +102,7 @@ class MockDiskCache : public disk_cache::Backend { net::OldCompletionCallback* callback) OVERRIDE; virtual int DoomEntry(const std::string& key, net::OldCompletionCallback* callback) OVERRIDE; - virtual int DoomAllEntries(net::OldCompletionCallback* callback) OVERRIDE; virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE; - virtual int DoomEntriesBetween(const base::Time initial_time, - const base::Time end_time, - net::OldCompletionCallback* callback) OVERRIDE; virtual int DoomEntriesBetween( const base::Time initial_time, const base::Time end_time, @@ -114,8 +110,6 @@ class MockDiskCache : public disk_cache::Backend { virtual int DoomEntriesSince(const base::Time initial_time, net::OldCompletionCallback* callback) OVERRIDE; virtual int OpenNextEntry(void** iter, disk_cache::Entry** next_entry, - net::OldCompletionCallback* callback) OVERRIDE; - virtual int OpenNextEntry(void** iter, disk_cache::Entry** next_entry, const net::CompletionCallback& callback) OVERRIDE; virtual void EndEnumeration(void** iter) OVERRIDE; virtual void GetStats( diff --git a/net/tools/dump_cache/upgrade.cc b/net/tools/dump_cache/upgrade.cc index b3a1312..b5e7dd1 100644 --- a/net/tools/dump_cache/upgrade.cc +++ b/net/tools/dump_cache/upgrade.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/file_path.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -733,9 +735,9 @@ int32 SlaveSM::GetEntryFromList() { int rv; if (input_->msg.command == GET_NEXT_ENTRY) { - rv = cache_->OpenNextEntry(&iterator_, - reinterpret_cast<disk_cache::Entry**>(&entry_), - &next_callback_); + rv = cache_->OpenNextEntry( + &iterator_, reinterpret_cast<disk_cache::Entry**>(&entry_), + base::Bind(&SlaveSM::DoGetEntryComplete, base::Unretained(this))); } else { DCHECK(input_->msg.command == GET_PREV_ENTRY); rv = cache_->OpenPrevEntry(&iterator_, diff --git a/net/url_request/view_cache_helper.cc b/net/url_request/view_cache_helper.cc index e0f6456..fbebb48 100644 --- a/net/url_request/view_cache_helper.cc +++ b/net/url_request/view_cache_helper.cc @@ -4,6 +4,8 @@ #include "net/url_request/view_cache_helper.h" +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/stringprintf.h" #include "net/base/escape.h" #include "net/base/io_buffer.h" @@ -242,7 +244,9 @@ int ViewCacheHelper::DoGetBackendComplete(int result) { int ViewCacheHelper::DoOpenNextEntry() { next_state_ = STATE_OPEN_NEXT_ENTRY_COMPLETE; - return disk_cache_->OpenNextEntry(&iter_, &entry_, &cache_callback_); + return disk_cache_->OpenNextEntry( + &iter_, &entry_, + base::Bind(&ViewCacheHelper::OnIOComplete, base::Unretained(this))); } int ViewCacheHelper::DoOpenNextEntryComplete(int result) { |