| 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
|
|
|