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: chrome/browser/extensions/updater/local_extension_cache.cc

Issue 148013004: Add UMA stats for ExtensionCache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments resolved Created 6 years, 11 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 | « chrome/browser/extensions/updater/local_extension_cache.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/updater/local_extension_cache.cc
diff --git a/chrome/browser/extensions/updater/local_extension_cache.cc b/chrome/browser/extensions/updater/local_extension_cache.cc
index 7411805ba65006239234ec5bac5faad35d37f2c2..052aca07cf970e148c9b3d8504b738391ffe1ecf 100644
--- a/chrome/browser/extensions/updater/local_extension_cache.cc
+++ b/chrome/browser/extensions/updater/local_extension_cache.cc
@@ -29,7 +29,7 @@ const char LocalExtensionCache::kCacheReadyFlagFileName[] = ".initialized";
LocalExtensionCache::LocalExtensionCache(
const base::FilePath& cache_dir,
- size_t max_cache_size,
+ uint64 max_cache_size,
const base::TimeDelta& max_cache_age,
const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner)
: cache_dir_(cache_dir),
@@ -151,6 +151,21 @@ bool LocalExtensionCache::RemoveExtension(const std::string& id) {
return true;
}
+bool LocalExtensionCache::GetStatistics(uint64* cache_size,
+ size_t* extensions_count) {
+ if (state_ != kReady)
+ return false;
+
+ *cache_size = 0;
+ for (CacheMap::iterator it = cached_extensions_.begin();
+ it != cached_extensions_.end(); ++it) {
+ *cache_size += it->second.size;
+ }
+ *extensions_count = cached_extensions_.size();
+
+ return true;
+}
+
void LocalExtensionCache::SetCacheStatusPollingDelayForTests(
const base::TimeDelta& delay) {
cache_status_polling_delay_ = delay;
@@ -425,7 +440,7 @@ void LocalExtensionCache::CleanUp() {
std::vector<CacheMap::iterator> items;
items.reserve(cached_extensions_.size());
- size_t total_size = 0;
+ uint64_t total_size = 0;
for (CacheMap::iterator it = cached_extensions_.begin();
it != cached_extensions_.end(); ++it) {
items.push_back(it);
« no previous file with comments | « chrome/browser/extensions/updater/local_extension_cache.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698