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

Unified Diff: extensions/browser/api/storage/local_value_store_cache.cc

Issue 595683002: Gather metrics on hosted app unlimitedStorage usage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/storage/local_value_store_cache.cc
diff --git a/extensions/browser/api/storage/local_value_store_cache.cc b/extensions/browser/api/storage/local_value_store_cache.cc
index 4865b31ed0206459fe190e010be8cb170a5b8e91..df183b994fb7d88ff90934e78fa868f95adbb060 100644
--- a/extensions/browser/api/storage/local_value_store_cache.cc
+++ b/extensions/browser/api/storage/local_value_store_cache.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_path.h"
+#include "base/metrics/histogram.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/storage/settings_storage_factory.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
@@ -91,6 +92,16 @@ ValueStore* LocalValueStoreCache::GetStorage(
new SettingsStorageQuotaEnforcer(
quota_, storage_factory_->Create(file_path, extension->id())));
DCHECK(storage.get());
+
+ if (extension->permissions_data()->HasAPIPermission(
+ APIPermission::kUnlimitedStorage) &&
+ extension->is_hosted_app()) {
+ // We're interested in the amount of space hosted apps are using. Record it
+ // in KB the first time we load the storage for the extension.
+ UMA_HISTOGRAM_COUNTS_100("Extensions.HostedAppUnlimitedStorageUsage",
Mark P 2014/09/23 17:12:58 Are you sure you don't want one of the _MEMORY_ hi
Devlin 2014/09/23 20:58:03 Oh, didn't know those existed. Done. (To confirm
Mark P 2014/09/23 22:07:51 Looking at the code, it appears the answer is yes,
+ storage->GetBytesInUse() / 1024);
+ }
+
storage_map_[extension->id()] = storage;
return storage.get();
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698