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

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

Issue 240613004: Add UMA logging of extension creation flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment Created 6 years, 8 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 | extensions/common/extension.h » ('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 dbf79252ff3f693ed80c474858f943bf901db11c..aae26e3980d2f672137079c1dc43124e38593f89 100644
--- a/chrome/browser/extensions/installed_loader.cc
+++ b/chrome/browser/extensions/installed_loader.cc
@@ -114,6 +114,25 @@ BackgroundPageType GetBackgroundPageType(const Extension* extension) {
return EVENT_PAGE;
}
+// Records the creation flags of an extension grouped by
+// Extension::InitFromValueFlags.
+void RecordCreationFlags(const Extension* extension) {
+ // Since each flag is a separate bit in an int, this loop is needed to find
+ // the number of flags.
+ int highest_flag_bit = 0;
+ for (int i = 1; i < Extension::LAST_INIT_FROM_VALUE_FLAGS; i <<= 1)
+ ++highest_flag_bit;
jar (doing other things) 2014/04/29 16:25:56 I didn't read this section of the code carefully..
calamity 2014/05/12 03:39:10 Done.
+
+ int flag = 1;
+ for (int i = 1; i <= highest_flag_bit; ++i) {
jar (doing other things) 2014/04/29 16:25:56 Since higest_flag_bit == 9, this loop will only re
+ if (extension->creation_flags() & flag) {
jar (doing other things) 2014/04/29 16:25:56 Since you're only looking at 9 choices for |flag|,
+ UMA_HISTOGRAM_ENUMERATION(
+ "Extensions.LoadCreationFlags", i, highest_flag_bit + 1);
jar (doing other things) 2014/04/29 01:32:25 Other than |i| (which is the sample), the other ar
+ }
+ flag <<= 1;
+ }
+}
+
} // namespace
InstalledLoader::InstalledLoader(ExtensionService* extension_service)
@@ -403,6 +422,8 @@ void InstalledLoader::LoadAllExtensions() {
if (extensions::ManagedModeInfo::IsContentPack(ex->get()))
++content_pack_count;
+ RecordCreationFlags(*ex);
+
extension_service_->RecordPermissionMessagesHistogram(
ex->get(), "Extensions.Permissions_Load");
}
« no previous file with comments | « no previous file | extensions/common/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698