Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Defines the public interface of the disk cache. For more details see | 5 // Defines the public interface of the disk cache. For more details see |
| 6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache | 6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache |
| 7 | 7 |
| 8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_ | 8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_ |
| 9 #define NET_DISK_CACHE_DISK_CACHE_H_ | 9 #define NET_DISK_CACHE_DISK_CACHE_H_ |
| 10 | 10 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 // the first time. That will cause the enumeration to start at the head of | 120 // the first time. That will cause the enumeration to start at the head of |
| 121 // the cache. For subsequent calls, pass the same |iter| pointer again without | 121 // the cache. For subsequent calls, pass the same |iter| pointer again without |
| 122 // changing its value. This method returns ERR_FAILED when there are no more | 122 // changing its value. This method returns ERR_FAILED when there are no more |
| 123 // entries to enumerate. When the entry pointer is no longer needed, its | 123 // entries to enumerate. When the entry pointer is no longer needed, its |
| 124 // Close method should be called. The return value is a net error code. If | 124 // Close method should be called. The return value is a net error code. If |
| 125 // this method returns ERR_IO_PENDING, the |callback| will be invoked when the | 125 // this method returns ERR_IO_PENDING, the |callback| will be invoked when the |
| 126 // |next_entry| is available. The pointer to receive the |next_entry| must | 126 // |next_entry| is available. The pointer to receive the |next_entry| must |
| 127 // remain valid until the operation completes. | 127 // remain valid until the operation completes. |
| 128 // | 128 // |
| 129 // NOTE: This method does not modify the last_used field of the entry, and | 129 // NOTE: This method does not modify the last_used field of the entry, and |
| 130 // therefore it does not impact the eviction ranking of the entry. | 130 // therefore it does not impact the eviction ranking of the entry. However, |
| 131 // an enumeration will go through all entries on the cache only if the cache | |
| 132 // is not modified while the enumeration is taking place. Significantly | |
| 133 // altering the entry pointed by |iter| (for example, deleting the entry) will | |
| 134 // invalidate |iter|. Performing operations on an entry that modify the entry | |
| 135 // may result in loops in the enumeration, skipped entries or similar. | |
|
gavinp
2013/01/14 15:20:13
Good to spell this out.
The only nit is the use o
| |
| 131 virtual int OpenNextEntry(void** iter, Entry** next_entry, | 136 virtual int OpenNextEntry(void** iter, Entry** next_entry, |
| 132 const CompletionCallback& callback) = 0; | 137 const CompletionCallback& callback) = 0; |
| 133 | 138 |
| 134 // Releases iter without returning the next entry. Whenever OpenNextEntry() | 139 // Releases iter without returning the next entry. Whenever OpenNextEntry() |
| 135 // returns true, but the caller is not interested in continuing the | 140 // returns true, but the caller is not interested in continuing the |
| 136 // enumeration by calling OpenNextEntry() again, the enumeration must be | 141 // enumeration by calling OpenNextEntry() again, the enumeration must be |
| 137 // ended by calling this method with iter returned by OpenNextEntry(). | 142 // ended by calling this method with iter returned by OpenNextEntry(). |
| 138 virtual void EndEnumeration(void** iter) = 0; | 143 virtual void EndEnumeration(void** iter) = 0; |
| 139 | 144 |
| 140 // Return a list of cache statistics. | 145 // Return a list of cache statistics. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 // Note: This method is deprecated. | 302 // Note: This method is deprecated. |
| 298 virtual int ReadyForSparseIO(const CompletionCallback& callback) = 0; | 303 virtual int ReadyForSparseIO(const CompletionCallback& callback) = 0; |
| 299 | 304 |
| 300 protected: | 305 protected: |
| 301 virtual ~Entry() {} | 306 virtual ~Entry() {} |
| 302 }; | 307 }; |
| 303 | 308 |
| 304 } // namespace disk_cache | 309 } // namespace disk_cache |
| 305 | 310 |
| 306 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 311 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
| OLD | NEW |