| 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 // 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 adds re-use as a factor to evict | 10 // The new (in-development) eviction policy adds re-use as a factor to evict |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 if (header_->lru.filled) | 268 if (header_->lru.filled) |
| 269 return; | 269 return; |
| 270 | 270 |
| 271 header_->lru.filled = 1; | 271 header_->lru.filled = 1; |
| 272 | 272 |
| 273 if (header_->create_time) { | 273 if (header_->create_time) { |
| 274 // This is the first entry that we have to evict, generate some noise. | 274 // This is the first entry that we have to evict, generate some noise. |
| 275 backend_->FirstEviction(); | 275 backend_->FirstEviction(); |
| 276 } else { | 276 } else { |
| 277 // This is an old file, but we may want more reports from this user so | 277 // This is an old file, but we may want more reports from this user so |
| 278 // lets save some create_time. | 278 // lets save some create_time. Conversion cannot fail here. |
| 279 Time::Exploded old = {0}; | 279 const base::Time time_2009_3_1 = |
| 280 old.year = 2009; | 280 base::Time::FromInternalValue(12985574400000000); |
| 281 old.month = 3; | 281 header_->create_time = time_2009_3_1.ToInternalValue(); |
| 282 old.day_of_month = 1; | |
| 283 header_->create_time = Time::FromLocalExploded(old).ToInternalValue(); | |
| 284 } | 282 } |
| 285 } | 283 } |
| 286 } | 284 } |
| 287 | 285 |
| 288 Rankings::List Eviction::GetListForEntry(EntryImpl* entry) { | 286 Rankings::List Eviction::GetListForEntry(EntryImpl* entry) { |
| 289 return Rankings::NO_USE; | 287 return Rankings::NO_USE; |
| 290 } | 288 } |
| 291 | 289 |
| 292 bool Eviction::EvictEntry(CacheRankingsBlock* node, bool empty, | 290 bool Eviction::EvictEntry(CacheRankingsBlock* node, bool empty, |
| 293 Rankings::List list) { | 291 Rankings::List list) { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 Time::FromInternalValue(last2.get()->Data()->last_used)); | 597 Time::FromInternalValue(last2.get()->Data()->last_used)); |
| 600 if (last3.get()) | 598 if (last3.get()) |
| 601 CACHE_UMA(AGE, "HighUseAge", 0, | 599 CACHE_UMA(AGE, "HighUseAge", 0, |
| 602 Time::FromInternalValue(last3.get()->Data()->last_used)); | 600 Time::FromInternalValue(last3.get()->Data()->last_used)); |
| 603 if (last4.get()) | 601 if (last4.get()) |
| 604 CACHE_UMA(AGE, "DeletedAge", 0, | 602 CACHE_UMA(AGE, "DeletedAge", 0, |
| 605 Time::FromInternalValue(last4.get()->Data()->last_used)); | 603 Time::FromInternalValue(last4.get()->Data()->last_used)); |
| 606 } | 604 } |
| 607 | 605 |
| 608 } // namespace disk_cache | 606 } // namespace disk_cache |
| OLD | NEW |