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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // Updates the ranking information for an entry. | 34 // Updates the ranking information for an entry. |
35 void UpdateRank(EntryImpl* entry, bool modified); | 35 void UpdateRank(EntryImpl* entry, bool modified); |
36 | 36 |
37 // Notifications of interesting events for a given entry. | 37 // Notifications of interesting events for a given entry. |
38 void OnOpenEntry(EntryImpl* entry); | 38 void OnOpenEntry(EntryImpl* entry); |
39 void OnCreateEntry(EntryImpl* entry); | 39 void OnCreateEntry(EntryImpl* entry); |
40 void OnDoomEntry(EntryImpl* entry); | 40 void OnDoomEntry(EntryImpl* entry); |
41 void OnDestroyEntry(EntryImpl* entry); | 41 void OnDestroyEntry(EntryImpl* entry); |
42 | 42 |
| 43 // Testing interface. |
| 44 void SetTestMode(); |
| 45 void TrimDeletedList(bool empty); |
| 46 |
43 private: | 47 private: |
44 void PostDelayedTrim(); | 48 void PostDelayedTrim(); |
45 void DelayedTrim(); | 49 void DelayedTrim(); |
46 bool ShouldTrim(); | 50 bool ShouldTrim(); |
47 void ReportTrimTimes(EntryImpl* entry); | 51 void ReportTrimTimes(EntryImpl* entry); |
48 Rankings::List GetListForEntry(EntryImpl* entry); | 52 Rankings::List GetListForEntry(EntryImpl* entry); |
49 bool EvictEntry(CacheRankingsBlock* node, bool empty); | 53 bool EvictEntry(CacheRankingsBlock* node, bool empty); |
50 | 54 |
51 // We'll just keep for a while a separate set of methods that implement the | 55 // We'll just keep for a while a separate set of methods that implement the |
52 // new eviction algorithm. This code will replace the original methods when | 56 // new eviction algorithm. This code will replace the original methods when |
(...skipping 15 matching lines...) Expand all Loading... |
68 BackendImpl* backend_; | 72 BackendImpl* backend_; |
69 Rankings* rankings_; | 73 Rankings* rankings_; |
70 IndexHeader* header_; | 74 IndexHeader* header_; |
71 int max_size_; | 75 int max_size_; |
72 int trim_delays_; | 76 int trim_delays_; |
73 bool new_eviction_; | 77 bool new_eviction_; |
74 bool first_trim_; | 78 bool first_trim_; |
75 bool trimming_; | 79 bool trimming_; |
76 bool delay_trim_; | 80 bool delay_trim_; |
77 bool init_; | 81 bool init_; |
| 82 bool test_mode_; |
78 bool in_experiment_; | 83 bool in_experiment_; |
79 ScopedRunnableMethodFactory<Eviction> factory_; | 84 ScopedRunnableMethodFactory<Eviction> factory_; |
80 | 85 |
81 DISALLOW_COPY_AND_ASSIGN(Eviction); | 86 DISALLOW_COPY_AND_ASSIGN(Eviction); |
82 }; | 87 }; |
83 | 88 |
84 } // namespace disk_cache | 89 } // namespace disk_cache |
85 | 90 |
86 #endif // NET_DISK_CACHE_EVICTION_H_ | 91 #endif // NET_DISK_CACHE_EVICTION_H_ |
OLD | NEW |