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

Unified Diff: storage/browser/quota/quota_temporary_storage_evictor.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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: storage/browser/quota/quota_temporary_storage_evictor.cc
diff --git a/webkit/browser/quota/quota_temporary_storage_evictor.cc b/storage/browser/quota/quota_temporary_storage_evictor.cc
similarity index 82%
rename from webkit/browser/quota/quota_temporary_storage_evictor.cc
rename to storage/browser/quota/quota_temporary_storage_evictor.cc
index 47a36f86fef5d75be7284856f8e7357998c93710..e7bdc042d9ed685bd1849cb22d4ed267d23234eb 100644
--- a/webkit/browser/quota/quota_temporary_storage_evictor.cc
+++ b/storage/browser/quota/quota_temporary_storage_evictor.cc
@@ -2,25 +2,28 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/browser/quota/quota_temporary_storage_evictor.h"
+#include "storage/browser/quota/quota_temporary_storage_evictor.h"
#include <algorithm>
#include "base/bind.h"
#include "base/metrics/histogram.h"
#include "url/gurl.h"
-#include "webkit/browser/quota/quota_manager.h"
-
-#define UMA_HISTOGRAM_MBYTES(name, sample) \
- UMA_HISTOGRAM_CUSTOM_COUNTS( \
- (name), static_cast<int>((sample) / kMBytes), \
- 1, 10 * 1024 * 1024 /* 10TB */, 100)
-
-#define UMA_HISTOGRAM_MINUTES(name, sample) \
- UMA_HISTOGRAM_CUSTOM_TIMES( \
- (name), (sample), \
- base::TimeDelta::FromMinutes(1), \
- base::TimeDelta::FromDays(1), 50)
+#include "storage/browser/quota/quota_manager.h"
+
+#define UMA_HISTOGRAM_MBYTES(name, sample) \
+ UMA_HISTOGRAM_CUSTOM_COUNTS((name), \
+ static_cast<int>((sample) / kMBytes), \
+ 1, \
+ 10 * 1024 * 1024 /* 10TB */, \
+ 100)
+
+#define UMA_HISTOGRAM_MINUTES(name, sample) \
+ UMA_HISTOGRAM_CUSTOM_TIMES((name), \
+ (sample), \
+ base::TimeDelta::FromMinutes(1), \
+ base::TimeDelta::FromDays(1), \
+ 50)
namespace {
const int64 kMBytes = 1024 * 1024;
@@ -67,10 +70,8 @@ void QuotaTemporaryStorageEvictor::GetStatistics(
statistics_.num_errors_on_evicting_origin;
(*statistics)["errors-on-getting-usage-and-quota"] =
statistics_.num_errors_on_getting_usage_and_quota;
- (*statistics)["evicted-origins"] =
- statistics_.num_evicted_origins;
- (*statistics)["eviction-rounds"] =
- statistics_.num_eviction_rounds;
+ (*statistics)["evicted-origins"] = statistics_.num_evicted_origins;
+ (*statistics)["eviction-rounds"] = statistics_.num_eviction_rounds;
(*statistics)["skipped-eviction-rounds"] =
statistics_.num_skipped_eviction_rounds;
}
@@ -91,7 +92,7 @@ void QuotaTemporaryStorageEvictor::ReportPerRoundHistogram() {
round_statistics_.diskspace_shortage_at_round);
UMA_HISTOGRAM_MBYTES("Quota.EvictedBytesPerRound",
round_statistics_.usage_on_beginning_of_round -
- round_statistics_.usage_on_end_of_round);
+ round_statistics_.usage_on_end_of_round);
UMA_HISTOGRAM_COUNTS("Quota.NumberOfEvictedOriginsPerRound",
round_statistics_.num_evicted_origins_in_round);
}
@@ -141,15 +142,19 @@ void QuotaTemporaryStorageEvictor::Start() {
return;
histogram_timer_.Start(
- FROM_HERE, base::TimeDelta::FromMinutes(kHistogramReportIntervalMinutes),
- this, &QuotaTemporaryStorageEvictor::ReportPerHourHistogram);
+ FROM_HERE,
+ base::TimeDelta::FromMinutes(kHistogramReportIntervalMinutes),
+ this,
+ &QuotaTemporaryStorageEvictor::ReportPerHourHistogram);
}
void QuotaTemporaryStorageEvictor::StartEvictionTimerWithDelay(int delay_ms) {
if (eviction_timer_.IsRunning())
return;
- eviction_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(delay_ms),
- this, &QuotaTemporaryStorageEvictor::ConsiderEviction);
+ eviction_timer_.Start(FROM_HERE,
+ base::TimeDelta::FromMilliseconds(delay_ms),
+ this,
+ &QuotaTemporaryStorageEvictor::ConsiderEviction);
}
void QuotaTemporaryStorageEvictor::ConsiderEviction() {
@@ -227,14 +232,14 @@ void QuotaTemporaryStorageEvictor::OnGotLRUOrigin(const GURL& origin) {
return;
}
- quota_eviction_handler_->EvictOriginData(origin, kStorageTypeTemporary,
- base::Bind(
- &QuotaTemporaryStorageEvictor::OnEvictionComplete,
- weak_factory_.GetWeakPtr()));
+ quota_eviction_handler_->EvictOriginData(
+ origin,
+ kStorageTypeTemporary,
+ base::Bind(&QuotaTemporaryStorageEvictor::OnEvictionComplete,
+ weak_factory_.GetWeakPtr()));
}
-void QuotaTemporaryStorageEvictor::OnEvictionComplete(
- QuotaStatusCode status) {
+void QuotaTemporaryStorageEvictor::OnEvictionComplete(QuotaStatusCode status) {
DCHECK(CalledOnValidThread());
// Just calling ConsiderEviction() or StartEvictionTimerWithDelay() here is
« no previous file with comments | « storage/browser/quota/quota_temporary_storage_evictor.h ('k') | storage/browser/quota/special_storage_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698