Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 10 #pragma once |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 | 90 |
| 91 // Marks the entry, specified by the given key, for deletion. The return value | 91 // Marks the entry, specified by the given key, for deletion. The return value |
| 92 // is a net error code. If this method returns ERR_IO_PENDING, the |callback| | 92 // is a net error code. If this method returns ERR_IO_PENDING, the |callback| |
| 93 // will be invoked after the entry is doomed. | 93 // will be invoked after the entry is doomed. |
| 94 virtual int DoomEntry(const std::string& key, | 94 virtual int DoomEntry(const std::string& key, |
| 95 OldCompletionCallback* callback) = 0; | 95 OldCompletionCallback* callback) = 0; |
| 96 | 96 |
| 97 // Marks all entries for deletion. The return value is a net error code. If | 97 // Marks all entries for deletion. The return value is a net error code. If |
| 98 // this method returns ERR_IO_PENDING, the |callback| will be invoked when the | 98 // this method returns ERR_IO_PENDING, the |callback| will be invoked when the |
| 99 // operation completes. | 99 // operation completes. |
| 100 virtual int DoomAllEntries(OldCompletionCallback* callback) = 0; | |
| 101 virtual int DoomAllEntries(const net::CompletionCallback& callback) = 0; | 100 virtual int DoomAllEntries(const net::CompletionCallback& callback) = 0; |
| 102 | 101 |
| 103 // Marks a range of entries for deletion. This supports unbounded deletes in | 102 // Marks a range of entries for deletion. This supports unbounded deletes in |
| 104 // either direction by using null Time values for either argument. The return | 103 // either direction by using null Time values for either argument. The return |
| 105 // value is a net error code. If this method returns ERR_IO_PENDING, the | 104 // value is a net error code. If this method returns ERR_IO_PENDING, the |
| 106 // |callback| will be invoked when the operation completes. | 105 // |callback| will be invoked when the operation completes. |
| 107 virtual int DoomEntriesBetween(const base::Time initial_time, | 106 virtual int DoomEntriesBetween(const base::Time initial_time, |
| 108 const base::Time end_time, | 107 const base::Time end_time, |
| 109 OldCompletionCallback* callback) = 0; | |
| 110 virtual int DoomEntriesBetween(const base::Time initial_time, | |
| 111 const base::Time end_time, | |
| 112 const net::CompletionCallback& callback) = 0; | 108 const net::CompletionCallback& callback) = 0; |
| 113 | 109 |
| 114 // Marks all entries accessed since |initial_time| for deletion. The return | 110 // Marks all entries accessed since |initial_time| for deletion. The return |
| 115 // value is a net error code. If this method returns ERR_IO_PENDING, the | 111 // value is a net error code. If this method returns ERR_IO_PENDING, the |
| 116 // |callback| will be invoked when the operation completes. | 112 // |callback| will be invoked when the operation completes. |
| 117 virtual int DoomEntriesSince(const base::Time initial_time, | 113 virtual int DoomEntriesSince(const base::Time initial_time, |
| 118 OldCompletionCallback* callback) = 0; | 114 OldCompletionCallback* callback) = 0; |
|
dpapad
2011/12/15 17:27:41
Will the remaining |OldCompletionCallback|s conver
James Hawkins
2011/12/15 17:54:42
At some point, yes.
| |
| 119 | 115 |
| 120 // Enumerates the cache. Initialize |iter| to NULL before calling this method | 116 // Enumerates the cache. Initialize |iter| to NULL before calling this method |
| 121 // the first time. That will cause the enumeration to start at the head of | 117 // the first time. That will cause the enumeration to start at the head of |
| 122 // the cache. For subsequent calls, pass the same |iter| pointer again without | 118 // the cache. For subsequent calls, pass the same |iter| pointer again without |
| 123 // changing its value. This method returns ERR_FAILED when there are no more | 119 // changing its value. This method returns ERR_FAILED when there are no more |
| 124 // entries to enumerate. When the entry pointer is no longer needed, its | 120 // entries to enumerate. When the entry pointer is no longer needed, its |
| 125 // Close method should be called. The return value is a net error code. If | 121 // Close method should be called. The return value is a net error code. If |
| 126 // this method returns ERR_IO_PENDING, the |callback| will be invoked when the | 122 // this method returns ERR_IO_PENDING, the |callback| will be invoked when the |
| 127 // |next_entry| is available. The pointer to receive the |next_entry| must | 123 // |next_entry| is available. The pointer to receive the |next_entry| must |
| 128 // remain valid until the operation completes. | 124 // remain valid until the operation completes. |
| 129 // | 125 // |
| 130 // NOTE: This method does not modify the last_used field of the entry, and | 126 // NOTE: This method does not modify the last_used field of the entry, and |
| 131 // therefore it does not impact the eviction ranking of the entry. | 127 // therefore it does not impact the eviction ranking of the entry. |
| 132 virtual int OpenNextEntry(void** iter, Entry** next_entry, | 128 virtual int OpenNextEntry(void** iter, Entry** next_entry, |
| 133 OldCompletionCallback* callback) = 0; | |
| 134 virtual int OpenNextEntry(void** iter, Entry** next_entry, | |
| 135 const net::CompletionCallback& callback) = 0; | 129 const net::CompletionCallback& callback) = 0; |
| 136 | 130 |
| 137 // Releases iter without returning the next entry. Whenever OpenNextEntry() | 131 // Releases iter without returning the next entry. Whenever OpenNextEntry() |
| 138 // returns true, but the caller is not interested in continuing the | 132 // returns true, but the caller is not interested in continuing the |
| 139 // enumeration by calling OpenNextEntry() again, the enumeration must be | 133 // enumeration by calling OpenNextEntry() again, the enumeration must be |
| 140 // ended by calling this method with iter returned by OpenNextEntry(). | 134 // ended by calling this method with iter returned by OpenNextEntry(). |
| 141 virtual void EndEnumeration(void** iter) = 0; | 135 virtual void EndEnumeration(void** iter) = 0; |
| 142 | 136 |
| 143 // Return a list of cache statistics. | 137 // Return a list of cache statistics. |
| 144 virtual void GetStats( | 138 virtual void GetStats( |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 // Note: This method is deprecated. | 295 // Note: This method is deprecated. |
| 302 virtual int ReadyForSparseIO(OldCompletionCallback* completion_callback) = 0; | 296 virtual int ReadyForSparseIO(OldCompletionCallback* completion_callback) = 0; |
| 303 | 297 |
| 304 protected: | 298 protected: |
| 305 virtual ~Entry() {} | 299 virtual ~Entry() {} |
| 306 }; | 300 }; |
| 307 | 301 |
| 308 } // namespace disk_cache | 302 } // namespace disk_cache |
| 309 | 303 |
| 310 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 304 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
| OLD | NEW |