Chromium Code Reviews| Index: net/disk_cache/disk_cache.h |
| diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h |
| index 4f64b9afb02ac4219532491f592d0c7b269985fb..da73433eeff3b210aa6f36496ec6c43adb8a2e31 100644 |
| --- a/net/disk_cache/disk_cache.h |
| +++ b/net/disk_cache/disk_cache.h |
| @@ -13,6 +13,7 @@ |
| #include "base/basictypes.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/time/time.h" |
| #include "net/base/cache_type.h" |
| #include "net/base/completion_callback.h" |
| @@ -62,6 +63,11 @@ NET_EXPORT int CreateCacheBackend( |
| // The root interface for a disk cache instance. |
| class NET_EXPORT Backend { |
| public: |
| + class EnumerationState { |
| + public: |
| + virtual ~EnumerationState() = 0; |
| + }; |
| + typedef scoped_ptr<EnumerationState> Iterator; |
| typedef net::CompletionCallback CompletionCallback; |
| // If the backend is destroyed when there are operations in progress (any |
| @@ -70,7 +76,7 @@ class NET_EXPORT Backend { |
| // 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() {} |
| + virtual ~Backend(); |
|
gavinp
2014/09/04 17:52:52
As long as we were adding disk_cache.cc (for the b
|
| // Returns the type of this cache. |
| virtual net::CacheType GetCacheType() const = 0; |
| @@ -123,32 +129,15 @@ class NET_EXPORT Backend { |
| virtual int DoomEntriesSince(base::Time initial_time, |
| const CompletionCallback& 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 |
| - // 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. However, |
| - // an enumeration will go through all entries on the cache only if the cache |
| - // is not modified while the enumeration is taking place. Significantly |
| - // altering the entry pointed by |iter| (for example, deleting the entry) will |
| - // invalidate |iter|. Performing operations on an entry that modify the entry |
| - // may result in loops in the iteration, skipped entries or similar. |
| - virtual int OpenNextEntry(void** iter, Entry** next_entry, |
| + // Enumerates the cache. Initialize |iter| to NULL for the first call, and |
| + // provide it again for subsequent calls. For each successful step of |
| + // enumeration, OpenNextEntry returns OK and provides |next_entry|, which is |
| + // open and should be closed by the caller. This method returns ERR_FAILED at |
| + // the end of enumeration. If any entry in a cache is modified during |
| + // iteration, then the result of this function is thereafter undefined. |
| + virtual int OpenNextEntry(Iterator* iter, Entry** next_entry, |
| const 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 |
| - // ended by calling this method with iter returned by OpenNextEntry(). |
| - virtual void EndEnumeration(void** iter) = 0; |
| - |
| // Return a list of cache statistics. |
| virtual void GetStats( |
| std::vector<std::pair<std::string, std::string> >* stats) = 0; |
| @@ -310,7 +299,7 @@ class NET_EXPORT Entry { |
| virtual int ReadyForSparseIO(const CompletionCallback& callback) = 0; |
| protected: |
| - virtual ~Entry() {} |
| + virtual ~Entry(); |
|
gavinp
2014/09/04 17:52:52
(see discussion at https://codereview.chromium.org
|
| }; |
| struct EntryDeleter { |