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

Unified Diff: chrome/browser/profiles/profile_metrics.cc

Issue 33753002: Sooper experimental refactoring of the profile info cache. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 2 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/profiles/profile_manager.cc ('k') | chrome/browser/profiles/profile_shortcut_manager_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_metrics.cc
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc
index 5e743ada7ac7b3a18e3fa99b1457ed29c24c73d6..7a4d4e857f43f3c6a150c12665d38cc85bba66b4 100644
--- a/chrome/browser/profiles/profile_metrics.cc
+++ b/chrome/browser/profiles/profile_metrics.cc
@@ -74,22 +74,26 @@ void ProfileMetrics::LogNumberOfProfiles(ProfileManager* manager) {
number_of_profiles);
// Ignore other metrics if we have no profiles, e.g. in Chrome Frame tests.
- if (number_of_profiles) {
- size_t number_of_managed_profiles = 0;
- size_t number_of_signed_in_profiles = 0;
- for (size_t i = 0; i < number_of_profiles; ++i) {
- if (info_cache.ProfileIsManagedAtIndex(i))
- ++number_of_managed_profiles;
- if (!info_cache.GetUserNameOfProfileAtIndex(i).empty())
- ++number_of_signed_in_profiles;
- }
- UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfManagedProfiles",
- number_of_managed_profiles);
- UMA_HISTOGRAM_COUNTS_100("Profile.PercentageOfManagedProfiles",
- 100 * number_of_managed_profiles / number_of_profiles);
- UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles",
- number_of_signed_in_profiles);
+ if (!number_of_profiles)
+ return;
+
+ size_t number_of_managed_profiles = 0;
+ size_t number_of_signed_in_profiles = 0;
+
+ const std::vector<ProfileInfoEntry> entries(info_cache.GetProfilesSortedByName());
+ for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin();
+ it != entries.end(); ++it) {
+ if (it->IsManaged())
+ ++number_of_managed_profiles;
+ if (!it->user_name().empty())
+ ++number_of_signed_in_profiles;
}
+ UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfManagedProfiles",
+ number_of_managed_profiles);
+ UMA_HISTOGRAM_COUNTS_100("Profile.PercentageOfManagedProfiles",
+ 100 * number_of_managed_profiles / number_of_profiles);
+ UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles",
+ number_of_signed_in_profiles);
}
void ProfileMetrics::LogProfileAddNewUser(ProfileAdd metric) {
« no previous file with comments | « chrome/browser/profiles/profile_manager.cc ('k') | chrome/browser/profiles/profile_shortcut_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698