| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // See net/disk_cache/disk_cache.h for the public interface of the cache. | 5 // See net/disk_cache/disk_cache.h for the public interface of the cache. |
| 6 | 6 |
| 7 #ifndef NET_DISK_CACHE_BACKEND_IMPL_H_ | 7 #ifndef NET_DISK_CACHE_BACKEND_IMPL_H_ |
| 8 #define NET_DISK_CACHE_BACKEND_IMPL_H_ | 8 #define NET_DISK_CACHE_BACKEND_IMPL_H_ |
| 9 | 9 |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // Opens the next or previous entry on a cache iteration. | 201 // Opens the next or previous entry on a cache iteration. |
| 202 bool OpenFollowingEntry(bool forward, void** iter, Entry** next_entry); | 202 bool OpenFollowingEntry(bool forward, void** iter, Entry** next_entry); |
| 203 | 203 |
| 204 // Opens the next or previous entry on a single list. If successfull, | 204 // Opens the next or previous entry on a single list. If successfull, |
| 205 // |from_entry| will be updated to point to the new entry, otherwise it will | 205 // |from_entry| will be updated to point to the new entry, otherwise it will |
| 206 // be set to NULL; in other words, it is used as an explicit iterator. | 206 // be set to NULL; in other words, it is used as an explicit iterator. |
| 207 bool OpenFollowingEntryFromList(bool forward, Rankings::List list, | 207 bool OpenFollowingEntryFromList(bool forward, Rankings::List list, |
| 208 CacheRankingsBlock** from_entry, | 208 CacheRankingsBlock** from_entry, |
| 209 EntryImpl** next_entry); | 209 EntryImpl** next_entry); |
| 210 | 210 |
| 211 // Returns the entry that is pointed by |next|. | 211 // Returns the entry that is pointed by |next|. If we are trimming the cache, |
| 212 EntryImpl* GetEnumeratedEntry(CacheRankingsBlock* next); | 212 // |to_evict| should be true so that we don't perform extra disk writes. |
| 213 EntryImpl* GetEnumeratedEntry(CacheRankingsBlock* next, bool to_evict); |
| 213 | 214 |
| 214 // Re-opens an entry that was previously deleted. | 215 // Re-opens an entry that was previously deleted. |
| 215 bool ResurrectEntry(EntryImpl* deleted_entry, Entry** entry); | 216 bool ResurrectEntry(EntryImpl* deleted_entry, Entry** entry); |
| 216 | 217 |
| 217 void DestroyInvalidEntry(Addr address, EntryImpl* entry); | 218 void DestroyInvalidEntry(EntryImpl* entry); |
| 219 void DestroyInvalidEntryFromEnumeration(EntryImpl* entry); |
| 218 | 220 |
| 219 // Handles the used storage count. | 221 // Handles the used storage count. |
| 220 void AddStorageSize(int32 bytes); | 222 void AddStorageSize(int32 bytes); |
| 221 void SubstractStorageSize(int32 bytes); | 223 void SubstractStorageSize(int32 bytes); |
| 222 | 224 |
| 223 // Update the number of referenced cache entries. | 225 // Update the number of referenced cache entries. |
| 224 void IncreaseNumRefs(); | 226 void IncreaseNumRefs(); |
| 225 void DecreaseNumRefs(); | 227 void DecreaseNumRefs(); |
| 226 void IncreaseNumEntries(); | 228 void IncreaseNumEntries(); |
| 227 void DecreaseNumEntries(); | 229 void DecreaseNumEntries(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 275 |
| 274 DISALLOW_EVIL_CONSTRUCTORS(BackendImpl); | 276 DISALLOW_EVIL_CONSTRUCTORS(BackendImpl); |
| 275 }; | 277 }; |
| 276 | 278 |
| 277 // Returns the prefered max cache size given the available disk space. | 279 // Returns the prefered max cache size given the available disk space. |
| 278 int PreferedCacheSize(int64 available); | 280 int PreferedCacheSize(int64 available); |
| 279 | 281 |
| 280 } // namespace disk_cache | 282 } // namespace disk_cache |
| 281 | 283 |
| 282 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_ | 284 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_ |
| OLD | NEW |