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 // The eviction policy is a very simple pure LRU, so the elements at the end of | 5 // The eviction policy is a very simple pure LRU, so the elements at the end of |
6 // the list are evicted until kCleanUpMargin free space is available. There is | 6 // the list are evicted until kCleanUpMargin free space is available. There is |
7 // only one list in use (Rankings::NO_USE), and elements are sent to the front | 7 // only one list in use (Rankings::NO_USE), and elements are sent to the front |
8 // of the list whenever they are accessed. | 8 // of the list whenever they are accessed. |
9 | 9 |
10 // The new (in-development) eviction policy ads re-use as a factor to evict | 10 // The new (in-development) eviction policy ads re-use as a factor to evict |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if (++deleted == 4 && !empty) { | 97 if (++deleted == 4 && !empty) { |
98 #if defined(OS_WIN) | 98 #if defined(OS_WIN) |
99 MessageLoop::current()->PostTask(FROM_HERE, | 99 MessageLoop::current()->PostTask(FROM_HERE, |
100 factory_.NewRunnableMethod(&Eviction::TrimCache, false)); | 100 factory_.NewRunnableMethod(&Eviction::TrimCache, false)); |
101 break; | 101 break; |
102 #endif | 102 #endif |
103 } | 103 } |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 CACHE_UMA(AGE_MS, "TotalTrimTime", 0, start); | 107 CACHE_UMA(AGE_MS, "TotalTrimTime", backend_->GetSizeGroup(), start); |
108 trimming_ = false; | 108 trimming_ = false; |
109 Trace("*** Trim Cache end ***"); | 109 Trace("*** Trim Cache end ***"); |
110 return; | 110 return; |
111 } | 111 } |
112 | 112 |
113 void Eviction::UpdateRank(EntryImpl* entry, bool modified) { | 113 void Eviction::UpdateRank(EntryImpl* entry, bool modified) { |
114 if (new_eviction_) | 114 if (new_eviction_) |
115 return UpdateRankV2(entry, modified); | 115 return UpdateRankV2(entry, modified); |
116 | 116 |
117 rankings_->UpdateRank(entry->rankings(), modified, GetListForEntry(entry)); | 117 rankings_->UpdateRank(entry->rankings(), modified, GetListForEntry(entry)); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 list = kListsToSearch; | 269 list = kListsToSearch; |
270 } | 270 } |
271 | 271 |
272 if (empty) { | 272 if (empty) { |
273 TrimDeleted(true); | 273 TrimDeleted(true); |
274 } else if (header_->lru.sizes[Rankings::DELETED] > header_->num_entries / 4) { | 274 } else if (header_->lru.sizes[Rankings::DELETED] > header_->num_entries / 4) { |
275 MessageLoop::current()->PostTask(FROM_HERE, | 275 MessageLoop::current()->PostTask(FROM_HERE, |
276 factory_.NewRunnableMethod(&Eviction::TrimDeleted, empty)); | 276 factory_.NewRunnableMethod(&Eviction::TrimDeleted, empty)); |
277 } | 277 } |
278 | 278 |
279 CACHE_UMA(AGE_MS, "TotalTrimTime", 0, start); | 279 CACHE_UMA(AGE_MS, "TotalTrimTime", backend_->GetSizeGroup(), start); |
280 Trace("*** Trim Cache end ***"); | 280 Trace("*** Trim Cache end ***"); |
281 trimming_ = false; | 281 trimming_ = false; |
282 return; | 282 return; |
283 } | 283 } |
284 | 284 |
285 void Eviction::UpdateRankV2(EntryImpl* entry, bool modified) { | 285 void Eviction::UpdateRankV2(EntryImpl* entry, bool modified) { |
286 rankings_->UpdateRank(entry->rankings(), modified, GetListForEntryV2(entry)); | 286 rankings_->UpdateRank(entry->rankings(), modified, GetListForEntryV2(entry)); |
287 } | 287 } |
288 | 288 |
289 void Eviction::OnOpenEntryV2(EntryImpl* entry) { | 289 void Eviction::OnOpenEntryV2(EntryImpl* entry) { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 Time::FromInternalValue(last2.get()->Data()->last_used)); | 452 Time::FromInternalValue(last2.get()->Data()->last_used)); |
453 if (last3.get()) | 453 if (last3.get()) |
454 CACHE_UMA(AGE, "HighUseAge", header_->experiment, | 454 CACHE_UMA(AGE, "HighUseAge", header_->experiment, |
455 Time::FromInternalValue(last3.get()->Data()->last_used)); | 455 Time::FromInternalValue(last3.get()->Data()->last_used)); |
456 if (last4.get()) | 456 if (last4.get()) |
457 CACHE_UMA(AGE, "DeletedAge", header_->experiment, | 457 CACHE_UMA(AGE, "DeletedAge", header_->experiment, |
458 Time::FromInternalValue(last4.get()->Data()->last_used)); | 458 Time::FromInternalValue(last4.get()->Data()->last_used)); |
459 } | 459 } |
460 | 460 |
461 } // namespace disk_cache | 461 } // namespace disk_cache |
OLD | NEW |