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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 // Returns the time when this cache entry was last used. | 184 // Returns the time when this cache entry was last used. |
185 virtual base::Time GetLastUsed() const = 0; | 185 virtual base::Time GetLastUsed() const = 0; |
186 | 186 |
187 // Returns the time when this cache entry was last modified. | 187 // Returns the time when this cache entry was last modified. |
188 virtual base::Time GetLastModified() const = 0; | 188 virtual base::Time GetLastModified() const = 0; |
189 | 189 |
190 // Returns the size of the cache data with the given index. | 190 // Returns the size of the cache data with the given index. |
191 virtual int32_t GetDataSize(int index) const = 0; | 191 virtual int32_t GetDataSize(int index) const = 0; |
192 | 192 |
| 193 // Return size of all data streams, the key and other metadata. |
| 194 virtual int64_t GetEntrySize() const = 0; |
| 195 |
193 // Copies cached data into the given buffer of length |buf_len|. Returns the | 196 // Copies cached data into the given buffer of length |buf_len|. Returns the |
194 // number of bytes read or a network error code. If this function returns | 197 // number of bytes read or a network error code. If this function returns |
195 // ERR_IO_PENDING, the completion callback will be called on the current | 198 // ERR_IO_PENDING, the completion callback will be called on the current |
196 // thread when the operation completes, and a reference to |buf| will be | 199 // thread when the operation completes, and a reference to |buf| will be |
197 // retained until the callback is called. Note that as long as the function | 200 // retained until the callback is called. Note that as long as the function |
198 // does not complete immediately, the callback will always be invoked, even | 201 // does not complete immediately, the callback will always be invoked, even |
199 // after Close has been called; in other words, the caller may close this | 202 // after Close has been called; in other words, the caller may close this |
200 // entry without having to wait for all the callbacks, and still rely on the | 203 // entry without having to wait for all the callbacks, and still rely on the |
201 // cleanup performed from the callback code. | 204 // cleanup performed from the callback code. |
202 virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len, | 205 virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 entry->Close(); | 334 entry->Close(); |
332 } | 335 } |
333 }; | 336 }; |
334 | 337 |
335 // Automatically closes an entry when it goes out of scope. | 338 // Automatically closes an entry when it goes out of scope. |
336 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; | 339 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; |
337 | 340 |
338 } // namespace disk_cache | 341 } // namespace disk_cache |
339 | 342 |
340 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 343 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
OLD | NEW |