| Index: net/disk_cache/blockfile/eviction_v3.cc
|
| diff --git a/net/disk_cache/blockfile/eviction_v3.cc b/net/disk_cache/blockfile/eviction_v3.cc
|
| index 9d404a9172a071033dd82c31ee5cf6f46a22d18e..08e1e5dd21cb3203d3e011719ee6a420b0298354 100644
|
| --- a/net/disk_cache/blockfile/eviction_v3.cc
|
| +++ b/net/disk_cache/blockfile/eviction_v3.cc
|
| @@ -50,7 +50,7 @@ namespace {
|
| const int kCleanUpMargin = 1024 * 1024;
|
|
|
| #if defined(V3_NOT_JUST_YET_READY)
|
| -const int kHighUse = 10; // Reuse count to be on the HIGH_USE list.
|
| +const int kHighUse = 10; // Reuse count to be on the HIGH_USE list.
|
| const int kTargetTime = 24 * 7; // Time to be evicted (hours since last use).
|
| const int kMaxDelayedTrims = 60;
|
| #endif // defined(V3_NOT_JUST_YET_READY).
|
| @@ -268,12 +268,13 @@ bool EvictionV3::ShouldTrimDeleted() {
|
| // If the index is not loaded, the deleted list will tend to double the size
|
| // of the other lists 3 lists (40% of the total). Otherwise, all lists will be
|
| // about the same size.
|
| - int max_length = (index_load < 25) ? header_->num_entries * 2 / 5 :
|
| - header_->num_entries / 4;
|
| + int max_length = (index_load < 25) ? header_->num_entries * 2 / 5
|
| + : header_->num_entries / 4;
|
| return (!test_mode_ && header_->lru.sizes[Rankings::DELETED] > max_length);
|
| }
|
|
|
| -bool Eviction::EvictEntry(CacheRankingsBlock* node, bool empty,
|
| +bool Eviction::EvictEntry(CacheRankingsBlock* node,
|
| + bool empty,
|
| Rankings::List list) {
|
| EntryImplV3* entry = backend_->GetEnumeratedEntry(node, list);
|
| if (!entry) {
|
| @@ -342,8 +343,8 @@ void EvictionV3::TrimCacheV2(bool empty) {
|
| if (!next[list]->HasData())
|
| break;
|
| node.reset(next[list].release());
|
| - next[list].reset(rankings_->GetPrev(node.get(),
|
| - static_cast<Rankings::List>(list)));
|
| + next[list].reset(
|
| + rankings_->GetPrev(node.get(), static_cast<Rankings::List>(list)));
|
| if (node->Data()->dirty != backend_->GetCurrentEntryId() || empty) {
|
| // This entry is not being used by anybody.
|
| // Do NOT use node as an iterator after this point.
|
| @@ -396,7 +397,7 @@ void EvictionV3::TrimDeleted(bool empty) {
|
| TimeTicks start = TimeTicks::Now();
|
| Rankings::ScopedRankingsBlock node(rankings_);
|
| Rankings::ScopedRankingsBlock next(
|
| - rankings_, rankings_->GetPrev(node.get(), Rankings::DELETED));
|
| + rankings_, rankings_->GetPrev(node.get(), Rankings::DELETED));
|
| int deleted_entries = 0;
|
| while (next.get() &&
|
| (empty || (deleted_entries < 20 &&
|
| @@ -462,8 +463,8 @@ bool EvictionV3::NodeIsOldEnough(CacheRankingsBlock* node, int list) {
|
| }
|
|
|
| int EvictionV3::SelectListByLength(Rankings::ScopedRankingsBlock* next) {
|
| - int data_entries = header_->num_entries -
|
| - header_->lru.sizes[Rankings::DELETED];
|
| + int data_entries =
|
| + header_->num_entries - header_->lru.sizes[Rankings::DELETED];
|
| // Start by having each list to be roughly the same size.
|
| if (header_->lru.sizes[0] > data_entries / 3)
|
| return 0;
|
| @@ -485,26 +486,34 @@ void EvictionV3::ReportListStats() {
|
| if (!new_eviction_)
|
| return;
|
|
|
| - Rankings::ScopedRankingsBlock last1(rankings_,
|
| - rankings_->GetPrev(NULL, Rankings::NO_USE));
|
| - Rankings::ScopedRankingsBlock last2(rankings_,
|
| - rankings_->GetPrev(NULL, Rankings::LOW_USE));
|
| - Rankings::ScopedRankingsBlock last3(rankings_,
|
| - rankings_->GetPrev(NULL, Rankings::HIGH_USE));
|
| - Rankings::ScopedRankingsBlock last4(rankings_,
|
| - rankings_->GetPrev(NULL, Rankings::DELETED));
|
| + Rankings::ScopedRankingsBlock last1(
|
| + rankings_, rankings_->GetPrev(NULL, Rankings::NO_USE));
|
| + Rankings::ScopedRankingsBlock last2(
|
| + rankings_, rankings_->GetPrev(NULL, Rankings::LOW_USE));
|
| + Rankings::ScopedRankingsBlock last3(
|
| + rankings_, rankings_->GetPrev(NULL, Rankings::HIGH_USE));
|
| + Rankings::ScopedRankingsBlock last4(
|
| + rankings_, rankings_->GetPrev(NULL, Rankings::DELETED));
|
|
|
| if (last1.get())
|
| - CACHE_UMA(AGE, "NoUseAge", 0,
|
| + CACHE_UMA(AGE,
|
| + "NoUseAge",
|
| + 0,
|
| Time::FromInternalValue(last1.get()->Data()->last_used));
|
| if (last2.get())
|
| - CACHE_UMA(AGE, "LowUseAge", 0,
|
| + CACHE_UMA(AGE,
|
| + "LowUseAge",
|
| + 0,
|
| Time::FromInternalValue(last2.get()->Data()->last_used));
|
| if (last3.get())
|
| - CACHE_UMA(AGE, "HighUseAge", 0,
|
| + CACHE_UMA(AGE,
|
| + "HighUseAge",
|
| + 0,
|
| Time::FromInternalValue(last3.get()->Data()->last_used));
|
| if (last4.get())
|
| - CACHE_UMA(AGE, "DeletedAge", 0,
|
| + CACHE_UMA(AGE,
|
| + "DeletedAge",
|
| + 0,
|
| Time::FromInternalValue(last4.get()->Data()->last_used));
|
| }
|
| #endif // defined(V3_NOT_JUST_YET_READY).
|
|
|