Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: net/disk_cache/eviction.h

Issue 155314: Disk cache: Don't evict entries if we are busy doing other stuff.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef NET_DISK_CACHE_EVICTION_H_ 5 #ifndef NET_DISK_CACHE_EVICTION_H_
6 #define NET_DISK_CACHE_EVICTION_H_ 6 #define NET_DISK_CACHE_EVICTION_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 22 matching lines...) Expand all
33 // Updates the ranking information for an entry. 33 // Updates the ranking information for an entry.
34 void UpdateRank(EntryImpl* entry, bool modified); 34 void UpdateRank(EntryImpl* entry, bool modified);
35 35
36 // Notifications of interesting events for a given entry. 36 // Notifications of interesting events for a given entry.
37 void OnOpenEntry(EntryImpl* entry); 37 void OnOpenEntry(EntryImpl* entry);
38 void OnCreateEntry(EntryImpl* entry); 38 void OnCreateEntry(EntryImpl* entry);
39 void OnDoomEntry(EntryImpl* entry); 39 void OnDoomEntry(EntryImpl* entry);
40 void OnDestroyEntry(EntryImpl* entry); 40 void OnDestroyEntry(EntryImpl* entry);
41 41
42 private: 42 private:
43 void PostDelayedTrim();
44 void DelayedTrim();
43 void ReportTrimTimes(EntryImpl* entry); 45 void ReportTrimTimes(EntryImpl* entry);
44 Rankings::List GetListForEntry(EntryImpl* entry); 46 Rankings::List GetListForEntry(EntryImpl* entry);
45 bool EvictEntry(CacheRankingsBlock* node, bool empty); 47 bool EvictEntry(CacheRankingsBlock* node, bool empty);
46 48
47 // We'll just keep for a while a separate set of methods that implement the 49 // We'll just keep for a while a separate set of methods that implement the
48 // new eviction algorithm. This code will replace the original methods when 50 // new eviction algorithm. This code will replace the original methods when
49 // finished. 51 // finished.
50 void TrimCacheV2(bool empty); 52 void TrimCacheV2(bool empty);
51 void UpdateRankV2(EntryImpl* entry, bool modified); 53 void UpdateRankV2(EntryImpl* entry, bool modified);
52 void OnOpenEntryV2(EntryImpl* entry); 54 void OnOpenEntryV2(EntryImpl* entry);
53 void OnCreateEntryV2(EntryImpl* entry); 55 void OnCreateEntryV2(EntryImpl* entry);
54 void OnDoomEntryV2(EntryImpl* entry); 56 void OnDoomEntryV2(EntryImpl* entry);
55 void OnDestroyEntryV2(EntryImpl* entry); 57 void OnDestroyEntryV2(EntryImpl* entry);
56 Rankings::List GetListForEntryV2(EntryImpl* entry); 58 Rankings::List GetListForEntryV2(EntryImpl* entry);
57 void TrimDeleted(bool empty); 59 void TrimDeleted(bool empty);
58 bool RemoveDeletedNode(CacheRankingsBlock* node); 60 bool RemoveDeletedNode(CacheRankingsBlock* node);
59 61
60 bool NodeIsOldEnough(CacheRankingsBlock* node, int list); 62 bool NodeIsOldEnough(CacheRankingsBlock* node, int list);
61 int SelectListByLenght(); 63 int SelectListByLenght();
62 void ReportListStats(); 64 void ReportListStats();
63 65
64 BackendImpl* backend_; 66 BackendImpl* backend_;
65 Rankings* rankings_; 67 Rankings* rankings_;
66 IndexHeader* header_; 68 IndexHeader* header_;
67 int max_size_; 69 int max_size_;
68 bool new_eviction_; 70 bool new_eviction_;
69 bool first_trim_; 71 bool first_trim_;
70 bool trimming_; 72 bool trimming_;
73 bool delay_trim_;
71 ScopedRunnableMethodFactory<Eviction> factory_; 74 ScopedRunnableMethodFactory<Eviction> factory_;
72 75
73 DISALLOW_COPY_AND_ASSIGN(Eviction); 76 DISALLOW_COPY_AND_ASSIGN(Eviction);
74 }; 77 };
75 78
76 } // namespace disk_cache 79 } // namespace disk_cache
77 80
78 #endif // NET_DISK_CACHE_EVICTION_H_ 81 #endif // NET_DISK_CACHE_EVICTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698