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

Unified Diff: net/disk_cache/blockfile/eviction.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/blockfile/eviction.cc
diff --git a/net/disk_cache/blockfile/eviction.cc b/net/disk_cache/blockfile/eviction.cc
index 6355bc635a1459f00d1e7dbd0cd09a29355ba5e3..fc2d8f41f15405d33d62b6d2fbe10923244b028f 100644
--- a/net/disk_cache/blockfile/eviction.cc
+++ b/net/disk_cache/blockfile/eviction.cc
@@ -50,7 +50,7 @@ using base::TimeTicks;
namespace {
const int kCleanUpMargin = 1024 * 1024;
-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;
@@ -71,10 +71,7 @@ namespace disk_cache {
// The real initialization happens during Init(), init_ is the only member that
// has to be initialized here.
-Eviction::Eviction()
- : backend_(NULL),
- init_(false),
- ptr_factory_(this) {
+Eviction::Eviction() : backend_(NULL), init_(false), ptr_factory_(this) {
}
Eviction::~Eviction() {
@@ -245,8 +242,8 @@ bool Eviction::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);
}
@@ -282,7 +279,8 @@ Rankings::List Eviction::GetListForEntry(EntryImpl* entry) {
return Rankings::NO_USE;
}
-bool Eviction::EvictEntry(CacheRankingsBlock* node, bool empty,
+bool Eviction::EvictEntry(CacheRankingsBlock* node,
+ bool empty,
Rankings::List list) {
EntryImpl* entry = backend_->GetEnumeratedEntry(node, list);
if (!entry) {
@@ -353,8 +351,8 @@ void Eviction::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.
@@ -499,7 +497,7 @@ void Eviction::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 &&
@@ -551,8 +549,8 @@ bool Eviction::NodeIsOldEnough(CacheRankingsBlock* node, int list) {
}
int Eviction::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;
@@ -574,26 +572,34 @@ void Eviction::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));
}

Powered by Google App Engine
This is Rietveld 408576698