From f45f5fb9c5147aeccad73b013d3524f459c04872 Mon Sep 17 00:00:00 2001 From: "benwells@chromium.org" Date: Thu, 30 Jan 2014 03:55:34 +0000 Subject: [PATCH] Revert 247760 "Add UMA stats for ExtensionCache" > Add UMA stats for ExtensionCache > > Reported metrics: > - number of extensions in cache > - size of cache on disk > > BUG=316371 > TEST=manual > > Review URL: https://codereview.chromium.org/148013004 This causes compile failures on ChromeOS. See comments on original CL for details. TBR=dpolukhin@chromium.org Review URL: https://codereview.chromium.org/139173009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247822 0039d316-1c4b-4281-b951-d872f2087c98 --- .../extensions/updater/extension_cache_impl.cc | 10 ---------- .../extensions/updater/local_extension_cache.cc | 19 ++----------------- .../extensions/updater/local_extension_cache.h | 12 ++++-------- tools/metrics/histograms/histograms.xml | 14 -------------- 4 files changed, 6 insertions(+), 49 deletions(-) diff --git a/chrome/browser/extensions/updater/extension_cache_impl.cc b/chrome/browser/extensions/updater/extension_cache_impl.cc index 53addd598bdc..ddf0cd2e4ef1 100644 --- a/chrome/browser/extensions/updater/extension_cache_impl.cc +++ b/chrome/browser/extensions/updater/extension_cache_impl.cc @@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/memory/singleton.h" -#include "base/metrics/histogram.h" #include "base/sequenced_task_runner.h" #include "base/stl_util.h" #include "base/threading/sequenced_worker_pool.h" @@ -105,15 +104,6 @@ void ExtensionCacheImpl::OnCacheInitialized() { it->Run(); } init_callbacks_.clear(); - - uint64 cache_size = 0; - size_t extensions_count = 0; - if (cache_->GetStatistics(&cache_size, &extensions_count)) { - UMA_HISTOGRAM_COUNTS_100("Extensions.ExtensionCacheCount", - extensions_count); - UMA_HISTOGRAM_MEMORY_MB("Extensions.ExtensionCacheSize", - cache_size / (1024 * 1024)); - } } void ExtensionCacheImpl::Observe(int type, diff --git a/chrome/browser/extensions/updater/local_extension_cache.cc b/chrome/browser/extensions/updater/local_extension_cache.cc index 052aca07cf97..7411805ba650 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, - uint64 max_cache_size, + size_t max_cache_size, const base::TimeDelta& max_cache_age, const scoped_refptr& backend_task_runner) : cache_dir_(cache_dir), @@ -151,21 +151,6 @@ 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; @@ -440,7 +425,7 @@ void LocalExtensionCache::CleanUp() { std::vector items; items.reserve(cached_extensions_.size()); - uint64_t total_size = 0; + size_t total_size = 0; for (CacheMap::iterator it = cached_extensions_.begin(); it != cached_extensions_.end(); ++it) { items.push_back(it); diff --git a/chrome/browser/extensions/updater/local_extension_cache.h b/chrome/browser/extensions/updater/local_extension_cache.h index ff1f84c012bf..604b6707fbe7 100644 --- a/chrome/browser/extensions/updater/local_extension_cache.h +++ b/chrome/browser/extensions/updater/local_extension_cache.h @@ -32,7 +32,7 @@ class LocalExtensionCache { // means that all unused cache items will be removed on Shutdown. // All file I/O is done via the |backend_task_runner|. LocalExtensionCache(const base::FilePath& cache_dir, - uint64 max_cache_size, + size_t max_cache_size, const base::TimeDelta& max_cache_age, const scoped_refptr& backend_task_runner); @@ -73,10 +73,6 @@ class LocalExtensionCache { // removed from disk too. bool RemoveExtension(const std::string& id); - // Return cache statistics. Returns |false| if cache is not ready. - bool GetStatistics(uint64* cache_size, - size_t* extensions_count); - bool is_ready() const { return state_ == kReady; } bool is_uninitialized() const { return state_ == kUninitialized; } bool is_shutdown() const { return state_ == kShutdown; } @@ -88,12 +84,12 @@ class LocalExtensionCache { struct CacheItemInfo { std::string version; base::Time last_used; - uint64 size; + int64 size; base::FilePath file_path; CacheItemInfo(const std::string& version, const base::Time& last_used, - const uint64 size, + const size_t size, const base::FilePath& file_path); }; typedef std::map CacheMap; @@ -179,7 +175,7 @@ class LocalExtensionCache { base::FilePath cache_dir_; // Maximum size of cache dir on disk. - uint64 max_cache_size_; + size_t max_cache_size_; // Minimal age of unused item in cache, items prior to this age will be // deleted on shutdown. diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 7967fc7b11ce..d1a1a1030dc9 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -4425,20 +4425,6 @@ other types of suffix sets. The time for an extension's event page to load. - - - Number of cached extensions on disk. Reported on Chrome OS during user - session start. - - - - - - Total size of .crx files in cache on disk. Reported on Chrome OS during user - session start. - - - An extension has been installed. -- 2.11.4.GIT