From 90c7aa0fe476246b74608e564ea09f0d2a4951da Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Fri, 6 Mar 2009 20:05:34 +0000 Subject: New disk cache eviction algorithm (partial implementation). Disabled by a #def. When enabled, file format 2.1 is used, with a possible update from ver 2.0. If a version with this code disabled is run after the upgrade, it will just discard the file and go back to 2.0. We now put some of those extra list to use! Entries are separated into various lists depending on how often are used, and we keep track of previously evicted entries. If the new algorithm is not enabled, most of the code just goes through a different path (with the old code instead of the new one). One notable exception is OpenFollowingEntry, used to enumerate the entries on the cache; the code changed significantly to support the new version of the "cache iterator", but functionally should do the same as the current code. Review URL: http://codereview.chromium.org/27345 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11145 0039d316-1c4b-4281-b951-d872f2087c98 --- net/disk_cache/eviction.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'net/disk_cache/eviction.h') diff --git a/net/disk_cache/eviction.h b/net/disk_cache/eviction.h index dd4e467..2496357 100644 --- a/net/disk_cache/eviction.h +++ b/net/disk_cache/eviction.h @@ -42,11 +42,28 @@ class Eviction { private: void ReportTrimTimes(EntryImpl* entry); Rankings::List GetListForEntry(EntryImpl* entry); + bool EvictEntry(CacheRankingsBlock* node, bool empty); + + // We'll just keep for a while a separate set of methods that implement the + // new eviction algorithm. This code will replace the original methods when + // finished. + void TrimCacheV2(bool empty); + void UpdateRankV2(EntryImpl* entry, bool modified); + void OnOpenEntryV2(EntryImpl* entry); + void OnCreateEntryV2(EntryImpl* entry); + void OnDoomEntryV2(EntryImpl* entry); + void OnDestroyEntryV2(EntryImpl* entry); + Rankings::List GetListForEntryV2(EntryImpl* entry); + void TrimDeleted(bool empty); + + bool NodeIsOldEnough(CacheRankingsBlock* node, int list); + int SelectListByLenght(); BackendImpl* backend_; Rankings* rankings_; IndexHeader* header_; int max_size_; + bool new_eviction_; ScopedRunnableMethodFactory factory_; DISALLOW_COPY_AND_ASSIGN(Eviction); -- cgit v1.1