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

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

Issue 15203004: Disk cache: Reference CL for the implementation of file format version 3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 6 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
« no previous file with comments | « net/disk_cache/eviction.h ('k') | net/disk_cache/file.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 17 matching lines...) Expand all
28 28
29 #include "net/disk_cache/eviction.h" 29 #include "net/disk_cache/eviction.h"
30 30
31 #include "base/bind.h" 31 #include "base/bind.h"
32 #include "base/compiler_specific.h" 32 #include "base/compiler_specific.h"
33 #include "base/logging.h" 33 #include "base/logging.h"
34 #include "base/message_loop.h" 34 #include "base/message_loop.h"
35 #include "base/string_util.h" 35 #include "base/string_util.h"
36 #include "base/time.h" 36 #include "base/time.h"
37 #include "net/disk_cache/backend_impl.h" 37 #include "net/disk_cache/backend_impl.h"
38 #include "net/disk_cache/disk_format.h"
38 #include "net/disk_cache/entry_impl.h" 39 #include "net/disk_cache/entry_impl.h"
39 #include "net/disk_cache/experiments.h" 40 #include "net/disk_cache/experiments.h"
40 #include "net/disk_cache/histogram_macros.h" 41 #include "net/disk_cache/histogram_macros.h"
41 #include "net/disk_cache/trace.h" 42 #include "net/disk_cache/trace.h"
42 43
43 using base::Time; 44 using base::Time;
44 using base::TimeTicks; 45 using base::TimeTicks;
45 46
46 namespace { 47 namespace {
47 48
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } else { 291 } else {
291 entry->DeleteEntryData(false); 292 entry->DeleteEntryData(false);
292 EntryStore* info = entry->entry()->Data(); 293 EntryStore* info = entry->entry()->Data();
293 DCHECK_EQ(ENTRY_NORMAL, info->state); 294 DCHECK_EQ(ENTRY_NORMAL, info->state);
294 295
295 rankings_->Remove(entry->rankings(), GetListForEntryV2(entry), true); 296 rankings_->Remove(entry->rankings(), GetListForEntryV2(entry), true);
296 info->state = ENTRY_EVICTED; 297 info->state = ENTRY_EVICTED;
297 entry->entry()->Store(); 298 entry->entry()->Store();
298 rankings_->Insert(entry->rankings(), true, Rankings::DELETED); 299 rankings_->Insert(entry->rankings(), true, Rankings::DELETED);
299 } 300 }
300 if (!empty) { 301 if (!empty)
301 backend_->OnEvent(Stats::TRIM_ENTRY); 302 backend_->OnEvent(Stats::TRIM_ENTRY);
302 303
303 static const char gajs[] = "http://www.google-analytics.com/ga.js";
304 if (!entry->GetKey().compare(gajs))
305 backend_->OnEvent(Stats::GAJS_EVICTED);
306 }
307 entry->Release(); 304 entry->Release();
308 305
309 return true; 306 return true;
310 } 307 }
311 308
312 // ----------------------------------------------------------------------- 309 // -----------------------------------------------------------------------
313 310
314 void Eviction::TrimCacheV2(bool empty) { 311 void Eviction::TrimCacheV2(bool empty) {
315 Trace("*** Trim Cache ***"); 312 Trace("*** Trim Cache ***");
316 trimming_ = true; 313 trimming_ = true;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 Time::FromInternalValue(last2.get()->Data()->last_used)); 583 Time::FromInternalValue(last2.get()->Data()->last_used));
587 if (last3.get()) 584 if (last3.get())
588 CACHE_UMA(AGE, "HighUseAge", 0, 585 CACHE_UMA(AGE, "HighUseAge", 0,
589 Time::FromInternalValue(last3.get()->Data()->last_used)); 586 Time::FromInternalValue(last3.get()->Data()->last_used));
590 if (last4.get()) 587 if (last4.get())
591 CACHE_UMA(AGE, "DeletedAge", 0, 588 CACHE_UMA(AGE, "DeletedAge", 0,
592 Time::FromInternalValue(last4.get()->Data()->last_used)); 589 Time::FromInternalValue(last4.get()->Data()->last_used));
593 } 590 }
594 591
595 } // namespace disk_cache 592 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/eviction.h ('k') | net/disk_cache/file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698