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

Unified Diff: chrome/browser/extensions/installed_loader.cc

Issue 299853002: Make installed_loader UMA less wasteful. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 6 years, 7 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 | chrome/common/extensions/sync_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/installed_loader.cc
diff --git a/chrome/browser/extensions/installed_loader.cc b/chrome/browser/extensions/installed_loader.cc
index ab16252f0df436508c00f4ed1db55d1644c44059..5234e405686484948fb32cb58041e77f6ba3d851 100644
--- a/chrome/browser/extensions/installed_loader.cc
+++ b/chrome/browser/extensions/installed_loader.cc
@@ -59,8 +59,9 @@ enum ManifestReloadReason {
// long as existing values are not changed.
enum BackgroundPageType {
NO_BACKGROUND_PAGE = 0,
- BACKGROUND_PAGE_PERSISTENT = 1,
- EVENT_PAGE = 2,
+ BACKGROUND_PAGE_PERSISTENT,
+ EVENT_PAGE,
+ NUM_BACKGROUND_PAGE_TYPES
Devlin 2014/05/21 23:23:37 nit: New enum values must go above here.
not at google - send to devlin 2014/05/21 23:36:05 done and done and done
};
// Used in histogram Extensions.ExternalItemState. Values may be added, as
@@ -156,11 +157,11 @@ void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) {
// Once installed, non-unpacked extensions cannot change their IDs (e.g., by
// updating the 'key' field in their manifest).
// TODO(jstritar): migrate preferences when unpacked extensions change IDs.
- if (extension.get() && !Manifest::IsUnpackedLocation(extension->location()) &&
+ if (extension.get() &&
+ !Manifest::IsUnpackedLocation(extension->location()) &&
info.extension_id != extension->id()) {
error = errors::kCannotChangeExtensionID;
extension = NULL;
- content::RecordAction(UserMetricsAction("Extensions.IDChangedError"));
}
// Check policy on every load in case an extension was blacklisted while
@@ -222,8 +223,6 @@ void InstalledLoader::LoadAllExtensions() {
ManifestReloadReason reload_reason = ShouldReloadExtensionManifest(*info);
++reload_reason_counts[reload_reason];
- UMA_HISTOGRAM_ENUMERATION("Extensions.ManifestReloadEnumValue",
- reload_reason, 100);
if (reload_reason != NOT_NEEDED) {
// Reloading an extension reads files from disk. We do this on the
@@ -294,7 +293,6 @@ void InstalledLoader::LoadAllExtensions() {
int page_action_count = 0;
int browser_action_count = 0;
int disabled_for_permissions_count = 0;
- int item_user_count = 0;
int non_webstore_ntp_override_count = 0;
int incognito = 0;
int not_incognito = 0;
@@ -316,13 +314,15 @@ void InstalledLoader::LoadAllExtensions() {
// muck up any of the stats. Later, though, we want to omit component and
// unpacked, as they are less interesting.
if (extension->is_app())
- UMA_HISTOGRAM_ENUMERATION("Extensions.AppLocation", location, 100);
+ UMA_HISTOGRAM_ENUMERATION(
+ "Extensions.AppLocation", location, Manifest::NUM_LOCATIONS);
else if (extension->is_extension())
- UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionLocation", location, 100);
+ UMA_HISTOGRAM_ENUMERATION(
+ "Extensions.ExtensionLocation", location, Manifest::NUM_LOCATIONS);
if (!ManifestURL::UpdatesFromGallery(extension)) {
UMA_HISTOGRAM_ENUMERATION(
- "Extensions.NonWebstoreLocation", location, 100);
+ "Extensions.NonWebstoreLocation", location, Manifest::NUM_LOCATIONS);
// Check for inconsistencies if the extension was supposedly installed
// from the webstore.
@@ -370,7 +370,7 @@ void InstalledLoader::LoadAllExtensions() {
UMA_HISTOGRAM_ENUMERATION("Extensions.ManifestVersion",
extension->manifest_version(),
- 10);
+ 10); // TODO(kalman): Why 10 manifest versions?
// We might have wanted to count legacy packaged apps here, too, since they
// are effectively extensions. Unfortunately, it's too late, as we don't
@@ -378,13 +378,14 @@ void InstalledLoader::LoadAllExtensions() {
if (type == Manifest::TYPE_EXTENSION) {
UMA_HISTOGRAM_ENUMERATION("Extensions.BackgroundPageType",
GetBackgroundPageType(extension),
- 10);
+ NUM_BACKGROUND_PAGE_TYPES);
}
// Using an enumeration shows us the total installed ratio across all users.
// Using the totals per user at each startup tells us the distribution of
// usage for each user (e.g. 40% of users have at least one app installed).
- UMA_HISTOGRAM_ENUMERATION("Extensions.LoadType", type, 100);
+ UMA_HISTOGRAM_ENUMERATION(
+ "Extensions.LoadType", type, Manifest::NUM_LOAD_TYPES);
switch (type) {
case Manifest::TYPE_THEME:
++theme_count;
@@ -425,8 +426,6 @@ void InstalledLoader::LoadAllExtensions() {
}
break;
}
- if (!Manifest::IsExternalLocation(location))
- ++item_user_count;
if (extension_action_manager->GetPageAction(*extension))
++page_action_count;
@@ -502,7 +501,6 @@ void InstalledLoader::LoadAllExtensions() {
}
}
- UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAllUser", item_user_count);
UMA_HISTOGRAM_COUNTS_100("Extensions.LoadApp",
app_user_count + app_external_count);
UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAppUser", app_user_count);
« no previous file with comments | « no previous file | chrome/common/extensions/sync_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698