| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 typedef net::CompletionCallback CompletionCallback; | 60 typedef net::CompletionCallback CompletionCallback; |
| 61 | 61 |
| 62 // If the backend is destroyed when there are operations in progress (any | 62 // If the backend is destroyed when there are operations in progress (any |
| 63 // callback that has not been invoked yet), this method cancels said | 63 // callback that has not been invoked yet), this method cancels said |
| 64 // operations so the callbacks are not invoked, possibly leaving the work | 64 // operations so the callbacks are not invoked, possibly leaving the work |
| 65 // half way (for instance, dooming just a few entries). Note that pending IO | 65 // half way (for instance, dooming just a few entries). Note that pending IO |
| 66 // for a given Entry (as opposed to the Backend) will still generate a | 66 // for a given Entry (as opposed to the Backend) will still generate a |
| 67 // callback from within this method. | 67 // callback from within this method. |
| 68 virtual ~Backend() {} | 68 virtual ~Backend() {} |
| 69 | 69 |
| 70 // Returns the type of this cache. |
| 71 virtual net::CacheType GetCacheType() const = 0; |
| 72 |
| 70 // Returns the number of entries in the cache. | 73 // Returns the number of entries in the cache. |
| 71 virtual int32 GetEntryCount() const = 0; | 74 virtual int32 GetEntryCount() const = 0; |
| 72 | 75 |
| 73 // Opens an existing entry. Upon success, |entry| holds a pointer to an Entry | 76 // Opens an existing entry. Upon success, |entry| holds a pointer to an Entry |
| 74 // object representing the specified disk cache entry. When the entry pointer | 77 // object representing the specified disk cache entry. When the entry pointer |
| 75 // is no longer needed, its Close method should be called. The return value is | 78 // is no longer needed, its Close method should be called. The return value is |
| 76 // a net error code. If this method returns ERR_IO_PENDING, the |callback| | 79 // a net error code. If this method returns ERR_IO_PENDING, the |callback| |
| 77 // will be invoked when the entry is available. The pointer to receive the | 80 // will be invoked when the entry is available. The pointer to receive the |
| 78 // |entry| must remain valid until the operation completes. | 81 // |entry| must remain valid until the operation completes. |
| 79 virtual int OpenEntry(const std::string& key, Entry** entry, | 82 virtual int OpenEntry(const std::string& key, Entry** entry, |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // Note: This method is deprecated. | 301 // Note: This method is deprecated. |
| 299 virtual int ReadyForSparseIO(const CompletionCallback& callback) = 0; | 302 virtual int ReadyForSparseIO(const CompletionCallback& callback) = 0; |
| 300 | 303 |
| 301 protected: | 304 protected: |
| 302 virtual ~Entry() {} | 305 virtual ~Entry() {} |
| 303 }; | 306 }; |
| 304 | 307 |
| 305 } // namespace disk_cache | 308 } // namespace disk_cache |
| 306 | 309 |
| 307 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 310 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
| OLD | NEW |