diff options
author | dgrogan <dgrogan@chromium.org> | 2015-08-26 21:50:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-27 04:51:09 +0000 |
commit | ebddb0b512847170caf5296d98cdc2e5fde0e67b (patch) | |
tree | 854b411d41fcd059eb1e61cfccf8d4d2ebfc5502 /storage | |
parent | 18d1a7f3ba1f94a877d76d57cb8743143719eb8b (diff) | |
download | chromium_src-ebddb0b512847170caf5296d98cdc2e5fde0e67b.zip chromium_src-ebddb0b512847170caf5296d98cdc2e5fde0e67b.tar.gz chromium_src-ebddb0b512847170caf5296d98cdc2e5fde0e67b.tar.bz2 |
Record to UMA when a durable origin is passed over for eviction.
BUG=521075
Review URL: https://codereview.chromium.org/1305383002
Cr-Commit-Position: refs/heads/master@{#345798}
Diffstat (limited to 'storage')
-rw-r--r-- | storage/browser/quota/quota_database.cc | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/storage/browser/quota/quota_database.cc b/storage/browser/quota/quota_database.cc index b7b4ad3..cac1774 100644 --- a/storage/browser/quota/quota_database.cc +++ b/storage/browser/quota/quota_database.cc @@ -9,6 +9,7 @@ #include "base/auto_reset.h" #include "base/bind.h" #include "base/files/file_util.h" +#include "base/metrics/histogram_macros.h" #include "sql/connection.h" #include "sql/meta_table.h" #include "sql/statement.h" @@ -35,6 +36,24 @@ bool VerifyValidQuotaConfig(const char* key) { const int kCommitIntervalMs = 30000; +enum OriginType { + // This enum is logged to UMA so only append to it - don't change + // the meaning of the existing values. + OTHER = 0, + NONE = 1, + GOOGLE_DURABLE = 2, + NON_GOOGLE_DURABLE = 3, + GOOGLE_UNLIMITED_EXTENSION = 4, + NON_GOOGLE_UNLIMITED_EXTENSION = 5, + IN_USE = 6, + + MAX_ORIGIN_TYPE +}; + +void HistogramOriginType(const OriginType& entry) { + UMA_HISTOGRAM_ENUMERATION("Quota.LRUOriginTypes", entry, MAX_ORIGIN_TYPE); +} + } // anonymous namespace // static @@ -340,16 +359,28 @@ bool QuotaDatabase::GetLRUOrigin( while (statement.Step()) { GURL url(statement.ColumnString(0)); - if (exceptions.find(url) != exceptions.end()) - continue; - if (special_storage_policy && - (special_storage_policy->IsStorageDurable(url) || - special_storage_policy->IsStorageUnlimited(url))) + if (exceptions.find(url) != exceptions.end()) { + HistogramOriginType(IN_USE); continue; + } + if (special_storage_policy) { + bool is_google = url.DomainIs("google.com"); + if (special_storage_policy->IsStorageDurable(url)) { + HistogramOriginType(is_google ? GOOGLE_DURABLE : NON_GOOGLE_DURABLE); + continue; + } + if (special_storage_policy->IsStorageUnlimited(url)) { + HistogramOriginType(is_google ? GOOGLE_UNLIMITED_EXTENSION + : NON_GOOGLE_UNLIMITED_EXTENSION); + continue; + } + } + HistogramOriginType(OTHER); *origin = url; return true; } + HistogramOriginType(NONE); *origin = GURL(); return statement.Succeeded(); } |