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

Side by Side Diff: net/disk_cache/blockfile/eviction.cc

Issue 2090713003: Make callers of FromUTC(Local)Exploded in net/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from eroman@ Created 4 years, 1 month 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
OLDNEW
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
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();
eroman 2016/10/27 21:44:34 For the record -- this is a bit different from wha
maksims (do not use this acc) 2016/11/29 07:38:56 Ok, thanks. Let it be like this.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698