diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 23:27:41 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 23:27:41 +0000 |
commit | 3cf35d9e60804a5398897d2abd96a6640bb4f00d (patch) | |
tree | fbc733e01fa66c118df9affcb87b85b2883349c9 | |
parent | 90fe71b4dd786fc659b7eea281dddddad8312f1a (diff) | |
download | chromium_src-3cf35d9e60804a5398897d2abd96a6640bb4f00d.zip chromium_src-3cf35d9e60804a5398897d2abd96a6640bb4f00d.tar.gz chromium_src-3cf35d9e60804a5398897d2abd96a6640bb4f00d.tar.bz2 |
Disk Cache: New interface that enables asynchronous completion
of any operation that may block.
BUG=26730
TEST=none
Review URL: http://codereview.chromium.org/355028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31160 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/disk_cache/backend_impl.cc | 49 | ||||
-rw-r--r-- | net/disk_cache/backend_impl.h | 12 | ||||
-rw-r--r-- | net/disk_cache/disk_cache.h | 109 | ||||
-rw-r--r-- | net/disk_cache/entry_impl.cc | 5 | ||||
-rw-r--r-- | net/disk_cache/entry_impl.h | 2 | ||||
-rw-r--r-- | net/disk_cache/mem_backend_impl.cc | 49 | ||||
-rw-r--r-- | net/disk_cache/mem_backend_impl.h | 12 | ||||
-rw-r--r-- | net/disk_cache/mem_entry_impl.cc | 5 | ||||
-rw-r--r-- | net/disk_cache/mem_entry_impl.h | 2 | ||||
-rw-r--r-- | net/http/http_cache_unittest.cc | 35 |
10 files changed, 274 insertions, 6 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 03da960..9ab3271 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -14,6 +14,7 @@ #include "base/sys_info.h" #include "base/timer.h" #include "base/worker_pool.h" +#include "net/base/net_errors.h" #include "net/disk_cache/cache_util.h" #include "net/disk_cache/entry_impl.h" #include "net/disk_cache/errors.h" @@ -379,6 +380,14 @@ bool BackendImpl::OpenEntry(const std::string& key, Entry** entry) { return true; } +int BackendImpl::OpenEntry(const std::string& key, Entry** entry, + CompletionCallback* callback) { + if (OpenEntry(key, entry)) + return net::OK; + + return net::ERR_FAILED; +} + bool BackendImpl::CreateEntry(const std::string& key, Entry** entry) { if (disabled_ || key.empty()) return false; @@ -461,6 +470,14 @@ bool BackendImpl::CreateEntry(const std::string& key, Entry** entry) { return true; } +int BackendImpl::CreateEntry(const std::string& key, Entry** entry, + CompletionCallback* callback) { + if (CreateEntry(key, entry)) + return net::OK; + + return net::ERR_FAILED; +} + bool BackendImpl::DoomEntry(const std::string& key) { if (disabled_) return false; @@ -492,6 +509,13 @@ bool BackendImpl::DoomAllEntries() { } } +int BackendImpl::DoomAllEntries(CompletionCallback* callback) { + if (DoomAllEntries()) + return net::OK; + + return net::ERR_FAILED; +} + bool BackendImpl::DoomEntriesBetween(const Time initial_time, const Time end_time) { if (end_time.is_null()) @@ -528,6 +552,15 @@ bool BackendImpl::DoomEntriesBetween(const Time initial_time, return true; } +int BackendImpl::DoomEntriesBetween(const base::Time initial_time, + const base::Time end_time, + CompletionCallback* callback) { + if (DoomEntriesBetween(initial_time, end_time)) + return net::OK; + + return net::ERR_FAILED; +} + // We use OpenNextEntry to retrieve elements from the cache, until we get // entries that are too old. bool BackendImpl::DoomEntriesSince(const Time initial_time) { @@ -552,10 +585,26 @@ bool BackendImpl::DoomEntriesSince(const Time initial_time) { } } +int BackendImpl::DoomEntriesSince(const base::Time initial_time, + CompletionCallback* callback) { + if (DoomEntriesSince(initial_time)) + return net::OK; + + return net::ERR_FAILED; +} + bool BackendImpl::OpenNextEntry(void** iter, Entry** next_entry) { return OpenFollowingEntry(true, iter, next_entry); } +int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry, + CompletionCallback* callback) { + if (OpenNextEntry(iter, next_entry)) + return net::OK; + + return net::ERR_FAILED; +} + void BackendImpl::EndEnumeration(void** iter) { scoped_ptr<Rankings::Iterator> iterator( reinterpret_cast<Rankings::Iterator*>(*iter)); diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h index 283256d..b9a288f 100644 --- a/net/disk_cache/backend_impl.h +++ b/net/disk_cache/backend_impl.h @@ -62,13 +62,25 @@ class BackendImpl : public Backend { // Backend interface. virtual int32 GetEntryCount() const; virtual bool OpenEntry(const std::string& key, Entry** entry); + virtual int OpenEntry(const std::string& key, Entry** entry, + CompletionCallback* callback); virtual bool CreateEntry(const std::string& key, Entry** entry); + virtual int CreateEntry(const std::string& key, Entry** entry, + CompletionCallback* callback); virtual bool DoomEntry(const std::string& key); virtual bool DoomAllEntries(); + virtual int DoomAllEntries(CompletionCallback* callback); virtual bool DoomEntriesBetween(const base::Time initial_time, const base::Time end_time); + virtual int DoomEntriesBetween(const base::Time initial_time, + const base::Time end_time, + CompletionCallback* callback); virtual bool DoomEntriesSince(const base::Time initial_time); + virtual int DoomEntriesSince(const base::Time initial_time, + CompletionCallback* callback); virtual bool OpenNextEntry(void** iter, Entry** next_entry); + virtual int OpenNextEntry(void** iter, Entry** next_entry, + CompletionCallback* callback); virtual void EndEnumeration(void** iter); virtual void GetStats(StatsItems* stats); diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h index a322021..c47bd47 100644 --- a/net/disk_cache/disk_cache.h +++ b/net/disk_cache/disk_cache.h @@ -26,6 +26,7 @@ namespace disk_cache { class Entry; class Backend; +typedef net::CompletionCallback CompletionCallback; // Returns an instance of the Backend. path points to a folder where // the cached data will be stored. This cache instance must be the only object @@ -36,6 +37,7 @@ class Backend; // If zero is passed in as max_bytes, the cache will determine the value to use // based on the available disk space. The returned pointer can be NULL if a // fatal error is found. +// Note: This function is deprecated. Backend* CreateCacheBackend(const FilePath& path, bool force, int max_bytes, net::CacheType type); @@ -44,11 +46,35 @@ Backend* CreateCacheBackend(const FilePath& path, bool force, // size the cache can grow to. If zero is passed in as max_bytes, the cache will // determine the value to use based on the available memory. The returned // pointer can be NULL if a fatal error is found. +// Note: This function is deprecated. Backend* CreateInMemoryCacheBackend(int max_bytes); +// 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 +// instance must be the only object that will be reading or writing files to +// that folder. The returned object should be deleted when not needed anymore. +// If |force| is true, and there is a problem with the cache initialization, the +// files will be deleted and a new set will be created. |max_bytes| is the +// maximum size the cache can grow to. If zero is passed in as |max_bytes|, the +// cache will determine the value to use. The returned pointer can be NULL if a +// fatal error is found. The actual return value of the function is a net error +// code. If this function returns ERR_IO_PENDING, the |callback| will be invoked +// when a backend is available or a fatal error condition is reached. The +// pointer to receive the |backend| must remain valid until the operation +// completes. +int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, + bool force, Backend** backend, + CompletionCallback* callback); + // The root interface for a disk cache instance. class Backend { public: + // If the backend is destroyed when there are operations in progress (any + // callback that has not been invoked yet), this method cancels said + // operations so the callbacks are not invoked, possibly leaving the work + // half way (for instance, dooming just a few entries). Note that pending IO + // for a given Entry (as opposed to the Backend) will still generate a + // callback from within this method. virtual ~Backend() {} // Returns the number of entries in the cache. @@ -58,28 +84,70 @@ class Backend { // to a Entry object representing the specified disk cache entry. // When the entry pointer is no longer needed, the Close method // should be called. + // Note: This method is deprecated. virtual bool OpenEntry(const std::string& key, Entry** entry) = 0; + // Opens an existing entry. Upon success, |entry| holds a pointer to an Entry + // object representing the specified disk cache entry. When the entry pointer + // is no longer needed, its Close method should be called. The return value is + // a net error code. If this method returns ERR_IO_PENDING, 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 OpenEntry(const std::string& key, Entry** entry, + CompletionCallback* callback) = 0; + // Creates a new entry. Upon success, the out param holds a pointer // to a Entry object representing the newly created disk cache // entry. When the entry pointer is no longer needed, the Close // method should be called. + // Note: This method is deprecated. virtual bool CreateEntry(const std::string& key, Entry** entry) = 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 + // entry pointer is no longer needed, its Close method should be called. The + // return value is a net error code. If this method returns ERR_IO_PENDING, + // 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; + // Marks the entry, specified by the given key, for deletion. virtual bool DoomEntry(const std::string& key) = 0; // Marks all entries for deletion. + // Note: This method is deprecated. virtual bool DoomAllEntries() = 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; + // Marks a range of entries for deletion. This supports unbounded deletes in // either direction by using null Time values for either argument. + // Note: This method is deprecated. virtual bool DoomEntriesBetween(const base::Time initial_time, const base::Time end_time) = 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 + // value is a net error code. If this method returns ERR_IO_PENDING, the + // |callback| will be invoked when the operation completes. + virtual int DoomEntriesBetween(const base::Time initial_time, + const base::Time end_time, + CompletionCallback* callback) = 0; + // Marks all entries accessed since initial_time for deletion. + // Note: This method is deprecated. virtual bool DoomEntriesSince(const base::Time initial_time) = 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; + // Enumerate the cache. Initialize iter to NULL before calling this method // the first time. That will cause the enumeration to start at the head of // the cache. For subsequent calls, pass the same iter pointer again without @@ -89,8 +157,24 @@ class 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. + // Note: This method is deprecated. virtual bool OpenNextEntry(void** iter, Entry** next_entry) = 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 + // the cache. For subsequent calls, pass the same |iter| pointer again without + // changing its value. This method returns ERR_FAILED when there are no more + // entries to enumerate. When the entry pointer is no longer needed, its + // Close method should be called. The return value is a net error code. If + // this method returns ERR_IO_PENDING, the |callback| will be invoked when the + // |next_entry| is available. The pointer to receive the |next_entry| must + // remain valid until the operation completes. + // + // 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; + // Releases iter without returning the next entry. Whenever OpenNextEntry() // returns true, but the caller is not interested in continuing the // enumeration by calling OpenNextEntry() again, the enumeration must be @@ -137,7 +221,7 @@ class 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, - net::CompletionCallback* completion_callback) = 0; + CompletionCallback* 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 @@ -153,7 +237,7 @@ class 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, - net::CompletionCallback* completion_callback, + CompletionCallback* completion_callback, bool truncate) = 0; // Sparse entries support: @@ -201,7 +285,7 @@ class 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, - net::CompletionCallback* completion_callback) = 0; + CompletionCallback* 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 @@ -210,7 +294,7 @@ class 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, - net::CompletionCallback* completion_callback) = 0; + CompletionCallback* 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 @@ -219,8 +303,21 @@ class Entry { // minimum number of consecutive stored bytes. Note that it is possible that // this entry has stored more than the returned value. This method returns a // net error code whenever the request cannot be completed successfully. + // Note: This method is deprecated. virtual int GetAvailableRange(int64 offset, int len, int64* start) = 0; + // Returns information about the currently stored portion of a sparse entry. + // |offset| and |len| describe a particular range that should be scanned to + // find out if it is stored or not. |start| will contain the offset of the + // first byte that is stored within this range, and the return value is the + // minimum number of consecutive stored bytes. Note that it is possible that + // this entry has stored more than the returned value. This method returns a + // net error code whenever the request cannot be completed successfully. If + // 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; + // Cancels any pending sparse IO operation (if any). The completion callback // of the operation in question will still be called when the operation // finishes, but the operation will finish sooner when this method is used. @@ -238,8 +335,8 @@ class Entry { // // Note that CancelSparseIO may have been called on another instance of this // object that refers to the same physical disk entry. - virtual int ReadyForSparseIO( - net::CompletionCallback* completion_callback) = 0; + // Note: This method is deprecated. + virtual int ReadyForSparseIO(CompletionCallback* completion_callback) = 0; protected: virtual ~Entry() {} diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc index 8749f26..e3fda2a 100644 --- a/net/disk_cache/entry_impl.cc +++ b/net/disk_cache/entry_impl.cc @@ -384,6 +384,11 @@ int EntryImpl::GetAvailableRange(int64 offset, int len, int64* start) { return sparse_->GetAvailableRange(offset, len, start); } +int EntryImpl::GetAvailableRange(int64 offset, int len, int64* start, + CompletionCallback* callback) { + return GetAvailableRange(offset, len, start); +} + void EntryImpl::CancelSparseIO() { if (!sparse_.get()) return; diff --git a/net/disk_cache/entry_impl.h b/net/disk_cache/entry_impl.h index 0d0bf09..76e4965 100644 --- a/net/disk_cache/entry_impl.h +++ b/net/disk_cache/entry_impl.h @@ -48,6 +48,8 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, net::CompletionCallback* completion_callback); virtual int GetAvailableRange(int64 offset, int len, int64* start); + virtual int GetAvailableRange(int64 offset, int len, int64* start, + CompletionCallback* callback); virtual void CancelSparseIO(); virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback); diff --git a/net/disk_cache/mem_backend_impl.cc b/net/disk_cache/mem_backend_impl.cc index c3d3a26..0b0d7bd 100644 --- a/net/disk_cache/mem_backend_impl.cc +++ b/net/disk_cache/mem_backend_impl.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/sys_info.h" +#include "net/base/net_errors.h" #include "net/disk_cache/cache_util.h" #include "net/disk_cache/mem_entry_impl.h" @@ -99,6 +100,14 @@ bool MemBackendImpl::OpenEntry(const std::string& key, Entry** entry) { return true; } +int MemBackendImpl::OpenEntry(const std::string& key, Entry** entry, + CompletionCallback* callback) { + if (OpenEntry(key, entry)) + return net::OK; + + return net::ERR_FAILED; +} + bool MemBackendImpl::CreateEntry(const std::string& key, Entry** entry) { EntryMap::iterator it = entries_.find(key); if (it != entries_.end()) @@ -117,6 +126,14 @@ bool MemBackendImpl::CreateEntry(const std::string& key, Entry** entry) { return true; } +int MemBackendImpl::CreateEntry(const std::string& key, Entry** entry, + CompletionCallback* callback) { + if (CreateEntry(key, entry)) + return net::OK; + + return net::ERR_FAILED; +} + bool MemBackendImpl::DoomEntry(const std::string& key) { Entry* entry; if (!OpenEntry(key, &entry)) @@ -146,6 +163,13 @@ bool MemBackendImpl::DoomAllEntries() { return true; } +int MemBackendImpl::DoomAllEntries(CompletionCallback* callback) { + if (DoomAllEntries()) + return net::OK; + + return net::ERR_FAILED; +} + bool MemBackendImpl::DoomEntriesBetween(const Time initial_time, const Time end_time) { if (end_time.is_null()) @@ -172,6 +196,15 @@ bool MemBackendImpl::DoomEntriesBetween(const Time initial_time, return true; } +int MemBackendImpl::DoomEntriesBetween(const base::Time initial_time, + const base::Time end_time, + CompletionCallback* callback) { + if (DoomEntriesBetween(initial_time, end_time)) + return net::OK; + + return net::ERR_FAILED; +} + bool MemBackendImpl::DoomEntriesSince(const Time initial_time) { for (;;) { // Get the entry in the front. @@ -184,6 +217,14 @@ bool MemBackendImpl::DoomEntriesSince(const Time initial_time) { } } +int MemBackendImpl::DoomEntriesSince(const base::Time initial_time, + CompletionCallback* callback) { + if (DoomEntriesSince(initial_time)) + return net::OK; + + return net::ERR_FAILED; +} + bool MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry) { MemEntryImpl* current = reinterpret_cast<MemEntryImpl*>(*iter); MemEntryImpl* node = rankings_.GetNext(current); @@ -201,6 +242,14 @@ bool MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry) { return NULL != node; } +int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry, + CompletionCallback* callback) { + if (OpenNextEntry(iter, next_entry)) + return net::OK; + + return net::ERR_FAILED; +} + void MemBackendImpl::EndEnumeration(void** iter) { *iter = NULL; } diff --git a/net/disk_cache/mem_backend_impl.h b/net/disk_cache/mem_backend_impl.h index 66683a2..5c9899e 100644 --- a/net/disk_cache/mem_backend_impl.h +++ b/net/disk_cache/mem_backend_impl.h @@ -29,13 +29,25 @@ class MemBackendImpl : public Backend { // Backend interface. virtual int32 GetEntryCount() const; virtual bool OpenEntry(const std::string& key, Entry** entry); + virtual int OpenEntry(const std::string& key, Entry** entry, + CompletionCallback* callback); virtual bool CreateEntry(const std::string& key, Entry** entry); + virtual int CreateEntry(const std::string& key, Entry** entry, + CompletionCallback* callback); virtual bool DoomEntry(const std::string& key); virtual bool DoomAllEntries(); + virtual int DoomAllEntries(CompletionCallback* callback); virtual bool DoomEntriesBetween(const base::Time initial_time, const base::Time end_time); + virtual int DoomEntriesBetween(const base::Time initial_time, + const base::Time end_time, + CompletionCallback* callback); virtual bool DoomEntriesSince(const base::Time initial_time); + virtual int DoomEntriesSince(const base::Time initial_time, + CompletionCallback* callback); virtual bool OpenNextEntry(void** iter, Entry** next_entry); + virtual int OpenNextEntry(void** iter, Entry** next_entry, + CompletionCallback* 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 a970070..002b514 100644 --- a/net/disk_cache/mem_entry_impl.cc +++ b/net/disk_cache/mem_entry_impl.cc @@ -307,6 +307,11 @@ int MemEntryImpl::GetAvailableRange(int64 offset, int len, int64* start) { return 0; } +int MemEntryImpl::GetAvailableRange(int64 offset, int len, int64* start, + CompletionCallback* callback) { + return GetAvailableRange(offset, len, start); +} + int MemEntryImpl::ReadyForSparseIO( net::CompletionCallback* completion_callback) { return net::OK; diff --git a/net/disk_cache/mem_entry_impl.h b/net/disk_cache/mem_entry_impl.h index 3eb1467..4ff7a0f 100644 --- a/net/disk_cache/mem_entry_impl.h +++ b/net/disk_cache/mem_entry_impl.h @@ -68,6 +68,8 @@ class MemEntryImpl : public Entry { virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, net::CompletionCallback* completion_callback); virtual int GetAvailableRange(int64 offset, int len, int64* start); + virtual int GetAvailableRange(int64 offset, int len, int64* start, + CompletionCallback* callback); virtual void CancelSparseIO() {} virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback); diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index 1d1b2b9..6ba7188 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -228,6 +228,11 @@ class MockDiskEntry : public disk_cache::Entry, return count; } + virtual int GetAvailableRange(int64 offset, int len, int64* start, + net::CompletionCallback* callback) { + return net::ERR_NOT_IMPLEMENTED; + } + virtual void CancelSparseIO() { cancel_ = true; } virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback) { @@ -331,6 +336,11 @@ class MockDiskCache : public disk_cache::Backend { return true; } + virtual int OpenEntry(const std::string& key, disk_cache::Entry** entry, + net::CompletionCallback* callback) { + return net::ERR_NOT_IMPLEMENTED; + } + virtual bool CreateEntry(const std::string& key, disk_cache::Entry** entry) { if (fail_requests_) return false; @@ -354,6 +364,11 @@ class MockDiskCache : public disk_cache::Backend { return true; } + virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, + net::CompletionCallback* callback) { + return net::ERR_NOT_IMPLEMENTED; + } + virtual bool DoomEntry(const std::string& key) { EntryMap::iterator it = entries_.find(key); if (it != entries_.end()) { @@ -367,19 +382,39 @@ class MockDiskCache : public disk_cache::Backend { return false; } + virtual int DoomAllEntries(net::CompletionCallback* callback) { + return net::ERR_NOT_IMPLEMENTED; + } + virtual bool DoomEntriesBetween(const Time initial_time, const Time end_time) { return true; } + virtual int DoomEntriesBetween(const base::Time initial_time, + const base::Time end_time, + net::CompletionCallback* callback) { + return net::ERR_NOT_IMPLEMENTED; + } + virtual bool DoomEntriesSince(const Time initial_time) { return true; } + virtual int DoomEntriesSince(const base::Time initial_time, + net::CompletionCallback* callback) { + return net::ERR_NOT_IMPLEMENTED; + } + virtual bool OpenNextEntry(void** iter, disk_cache::Entry** next_entry) { return false; } + virtual int OpenNextEntry(void** iter, disk_cache::Entry** next_entry, + net::CompletionCallback* callback) { + return net::ERR_NOT_IMPLEMENTED; + } + virtual void EndEnumeration(void** iter) {} virtual void GetStats( |