| 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 // 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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; | 273 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; |
| 274 | 274 |
| 275 private: | 275 private: |
| 276 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; | 276 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; |
| 277 | 277 |
| 278 // Creates a new backing file for the cache index. | 278 // Creates a new backing file for the cache index. |
| 279 bool CreateBackingStore(disk_cache::File* file); | 279 bool CreateBackingStore(disk_cache::File* file); |
| 280 bool InitBackingStore(bool* file_created); | 280 bool InitBackingStore(bool* file_created); |
| 281 void AdjustMaxCacheSize(int table_len); | 281 void AdjustMaxCacheSize(int table_len); |
| 282 | 282 |
| 283 bool InitStats(); |
| 284 void StoreStats(); |
| 285 |
| 283 // Deletes the cache and starts again. | 286 // Deletes the cache and starts again. |
| 284 void RestartCache(bool failure); | 287 void RestartCache(bool failure); |
| 285 void PrepareForRestart(); | 288 void PrepareForRestart(); |
| 286 | 289 |
| 287 // Creates a new entry object. Returns zero on success, or a disk_cache error | 290 // Creates a new entry object. Returns zero on success, or a disk_cache error |
| 288 // on failure. | 291 // on failure. |
| 289 int NewEntry(Addr address, EntryImpl** entry); | 292 int NewEntry(Addr address, EntryImpl** entry); |
| 290 | 293 |
| 291 // Returns a given entry from the cache. The entry to match is determined by | 294 // Returns a given entry from the cache. The entry to match is determined by |
| 292 // key and hash, and the returned entry may be the matched one or it's parent | 295 // key and hash, and the returned entry may be the matched one or it's parent |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 389 |
| 387 DISALLOW_COPY_AND_ASSIGN(BackendImpl); | 390 DISALLOW_COPY_AND_ASSIGN(BackendImpl); |
| 388 }; | 391 }; |
| 389 | 392 |
| 390 // Returns the preferred max cache size given the available disk space. | 393 // Returns the preferred max cache size given the available disk space. |
| 391 NET_EXPORT_PRIVATE int PreferedCacheSize(int64 available); | 394 NET_EXPORT_PRIVATE int PreferedCacheSize(int64 available); |
| 392 | 395 |
| 393 } // namespace disk_cache | 396 } // namespace disk_cache |
| 394 | 397 |
| 395 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_ | 398 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_ |
| OLD | NEW |