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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 // Marks all entries for deletion. The return value is a net error code. If | 103 // Marks all entries for deletion. The return value is a net error code. If |
104 // this method returns ERR_IO_PENDING, the |callback| will be invoked when the | 104 // this method returns ERR_IO_PENDING, the |callback| will be invoked when the |
105 // operation completes. | 105 // operation completes. |
106 virtual int DoomAllEntries(const CompletionCallback& callback) = 0; | 106 virtual int DoomAllEntries(const CompletionCallback& callback) = 0; |
107 | 107 |
108 // Marks a range of entries for deletion. This supports unbounded deletes in | 108 // Marks a range of entries for deletion. This supports unbounded deletes in |
109 // either direction by using null Time values for either argument. The return | 109 // either direction by using null Time values for either argument. The return |
110 // value is a net error code. If this method returns ERR_IO_PENDING, the | 110 // value is a net error code. If this method returns ERR_IO_PENDING, the |
111 // |callback| will be invoked when the operation completes. | 111 // |callback| will be invoked when the operation completes. |
| 112 // Entries with |initial_time| <= access time < |end_time| are deleted. |
112 virtual int DoomEntriesBetween(base::Time initial_time, | 113 virtual int DoomEntriesBetween(base::Time initial_time, |
113 base::Time end_time, | 114 base::Time end_time, |
114 const CompletionCallback& callback) = 0; | 115 const CompletionCallback& callback) = 0; |
115 | 116 |
116 // Marks all entries accessed since |initial_time| for deletion. The return | 117 // Marks all entries accessed since |initial_time| for deletion. The return |
117 // value is a net error code. If this method returns ERR_IO_PENDING, the | 118 // value is a net error code. If this method returns ERR_IO_PENDING, the |
118 // |callback| will be invoked when the operation completes. | 119 // |callback| will be invoked when the operation completes. |
| 120 // Entries with |initial_time| <= access time are deleted. |
119 virtual int DoomEntriesSince(base::Time initial_time, | 121 virtual int DoomEntriesSince(base::Time initial_time, |
120 const CompletionCallback& callback) = 0; | 122 const CompletionCallback& callback) = 0; |
121 | 123 |
122 // Enumerates the cache. Initialize |iter| to NULL before calling this method | 124 // Enumerates the cache. Initialize |iter| to NULL before calling this method |
123 // the first time. That will cause the enumeration to start at the head of | 125 // the first time. That will cause the enumeration to start at the head of |
124 // the cache. For subsequent calls, pass the same |iter| pointer again without | 126 // the cache. For subsequent calls, pass the same |iter| pointer again without |
125 // changing its value. This method returns ERR_FAILED when there are no more | 127 // changing its value. This method returns ERR_FAILED when there are no more |
126 // entries to enumerate. When the entry pointer is no longer needed, its | 128 // entries to enumerate. When the entry pointer is no longer needed, its |
127 // Close method should be called. The return value is a net error code. If | 129 // Close method should be called. The return value is a net error code. If |
128 // this method returns ERR_IO_PENDING, the |callback| will be invoked when the | 130 // this method returns ERR_IO_PENDING, the |callback| will be invoked when the |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 entry->Close(); | 317 entry->Close(); |
316 } | 318 } |
317 }; | 319 }; |
318 | 320 |
319 // Automatically closes an entry when it goes out of scope. | 321 // Automatically closes an entry when it goes out of scope. |
320 typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr; | 322 typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr; |
321 | 323 |
322 } // namespace disk_cache | 324 } // namespace disk_cache |
323 | 325 |
324 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 326 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
OLD | NEW |