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

Unified Diff: components/user_prefs/tracked/tracked_preference_helper.cc

Issue 1519043002: Putting histogram names of tracked prefs in tracked_preference_histogram_name file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing New line error for mac. Created 5 years 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
Index: components/user_prefs/tracked/tracked_preference_helper.cc
diff --git a/components/user_prefs/tracked/tracked_preference_helper.cc b/components/user_prefs/tracked/tracked_preference_helper.cc
index ade75aea9f46266c456f794f47ad1089fc495d38..f2e6883cf8ad995c25f1cc2d4355c1464e0c8b5f 100644
--- a/components/user_prefs/tracked/tracked_preference_helper.cc
+++ b/components/user_prefs/tracked/tracked_preference_helper.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "components/user_prefs/tracked/tracked_preference_histogram_names.h"
TrackedPreferenceHelper::TrackedPreferenceHelper(
const std::string& pref_path,
@@ -53,33 +54,39 @@ void TrackedPreferenceHelper::ReportValidationResult(
PrefHashStoreTransaction::ValueState value_state) const {
switch (value_state) {
case PrefHashStoreTransaction::UNCHANGED:
- UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceUnchanged",
- reporting_id_, reporting_ids_count_);
+ UMA_HISTOGRAM_ENUMERATION(
+ user_prefs::tracked::kTrackedPrefHistogramUnchanged, reporting_id_,
+ reporting_ids_count_);
return;
case PrefHashStoreTransaction::CLEARED:
- UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceCleared",
- reporting_id_, reporting_ids_count_);
+ UMA_HISTOGRAM_ENUMERATION(
+ user_prefs::tracked::kTrackedPrefHistogramCleared, reporting_id_,
+ reporting_ids_count_);
return;
case PrefHashStoreTransaction::SECURE_LEGACY:
UMA_HISTOGRAM_ENUMERATION(
- "Settings.TrackedPreferenceMigratedLegacyDeviceId", reporting_id_,
- reporting_ids_count_);
+ user_prefs::tracked::kTrackedPrefHistogramMigratedLegacyDeviceId,
+ reporting_id_, reporting_ids_count_);
return;
case PrefHashStoreTransaction::CHANGED:
- UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceChanged",
- reporting_id_, reporting_ids_count_);
+ UMA_HISTOGRAM_ENUMERATION(
+ user_prefs::tracked::kTrackedPrefHistogramChanged, reporting_id_,
+ reporting_ids_count_);
return;
case PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE:
- UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceInitialized",
- reporting_id_, reporting_ids_count_);
+ UMA_HISTOGRAM_ENUMERATION(
+ user_prefs::tracked::kTrackedPrefHistogramInitialized, reporting_id_,
+ reporting_ids_count_);
return;
case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE:
- UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceTrustedInitialized",
- reporting_id_, reporting_ids_count_);
+ UMA_HISTOGRAM_ENUMERATION(
+ user_prefs::tracked::kTrackedPrefHistogramTrustedInitialized,
+ reporting_id_, reporting_ids_count_);
return;
case PrefHashStoreTransaction::TRUSTED_NULL_VALUE:
- UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceNullInitialized",
- reporting_id_, reporting_ids_count_);
+ UMA_HISTOGRAM_ENUMERATION(
+ user_prefs::tracked::kTrackedPrefHistogramNullInitialized,
+ reporting_id_, reporting_ids_count_);
return;
}
NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: "
@@ -92,11 +99,12 @@ void TrackedPreferenceHelper::ReportAction(ResetAction reset_action) const {
// No report for DONT_RESET.
break;
case WANTED_RESET:
- UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceWantedReset",
- reporting_id_, reporting_ids_count_);
+ UMA_HISTOGRAM_ENUMERATION(
+ user_prefs::tracked::kTrackedPrefHistogramWantedReset, reporting_id_,
+ reporting_ids_count_);
break;
case DO_RESET:
- UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceReset",
+ UMA_HISTOGRAM_ENUMERATION(user_prefs::tracked::kTrackedPrefHistogramReset,
reporting_id_, reporting_ids_count_);
break;
}
@@ -107,12 +115,9 @@ void TrackedPreferenceHelper::ReportSplitPreferenceChangedCount(
// The histogram below is an expansion of the UMA_HISTOGRAM_COUNTS_100 macro
// adapted to allow for a dynamically suffixed histogram name.
// Note: The factory creates and owns the histogram.
- base::HistogramBase* histogram =
- base::LinearHistogram::FactoryGet(
- "Settings.TrackedSplitPreferenceChanged." + pref_path_,
- 1,
- 100, // Allow counts up to 100.
- 101,
- base::HistogramBase::kUmaTargetedHistogramFlag);
+ base::HistogramBase* histogram = base::LinearHistogram::FactoryGet(
+ user_prefs::tracked::kTrackedSplitPrefHistogramChanged + pref_path_, 1,
+ 100, // Allow counts up to 100.
+ 101, base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->Add(count);
}
« no previous file with comments | « components/user_prefs/tracked/BUILD.gn ('k') | components/user_prefs/tracked/tracked_preference_histogram_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698