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

Side by Side Diff: components/user_prefs/tracked/tracked_preference_helper.cc

Issue 2204943002: Integrate registry_hash_store_contents with the rest of tracked prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove a lost include statement Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/user_prefs/tracked/tracked_preference_helper.h" 5 #include "components/user_prefs/tracked/tracked_preference_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "components/user_prefs/tracked/tracked_preference_histogram_names.h" 9 #include "components/user_prefs/tracked/tracked_preference_histogram_names.h"
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: " 44 NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: "
45 << value_state; 45 << value_state;
46 return DONT_RESET; 46 return DONT_RESET;
47 } 47 }
48 48
49 bool TrackedPreferenceHelper::IsPersonal() const { 49 bool TrackedPreferenceHelper::IsPersonal() const {
50 return personal_; 50 return personal_;
51 } 51 }
52 52
53 void TrackedPreferenceHelper::ReportValidationResult( 53 void TrackedPreferenceHelper::ReportValidationResult(
54 PrefHashStoreTransaction::ValueState value_state) const { 54 PrefHashStoreTransaction::ValueState value_state,
55 const std::string& validation_type_suffix) const {
56 const char* histogram_name;
55 switch (value_state) { 57 switch (value_state) {
56 case PrefHashStoreTransaction::UNCHANGED: 58 case PrefHashStoreTransaction::UNCHANGED:
57 UMA_HISTOGRAM_ENUMERATION( 59 histogram_name = user_prefs::tracked::kTrackedPrefHistogramUnchanged;
58 user_prefs::tracked::kTrackedPrefHistogramUnchanged, reporting_id_, 60 break;
59 reporting_ids_count_);
60 return;
61 case PrefHashStoreTransaction::CLEARED: 61 case PrefHashStoreTransaction::CLEARED:
62 UMA_HISTOGRAM_ENUMERATION( 62 histogram_name = user_prefs::tracked::kTrackedPrefHistogramCleared;
63 user_prefs::tracked::kTrackedPrefHistogramCleared, reporting_id_, 63 break;
64 reporting_ids_count_);
65 return;
66 case PrefHashStoreTransaction::SECURE_LEGACY: 64 case PrefHashStoreTransaction::SECURE_LEGACY:
67 UMA_HISTOGRAM_ENUMERATION( 65 histogram_name =
68 user_prefs::tracked::kTrackedPrefHistogramMigratedLegacyDeviceId, 66 user_prefs::tracked::kTrackedPrefHistogramMigratedLegacyDeviceId;
69 reporting_id_, reporting_ids_count_); 67 break;
70 return;
71 case PrefHashStoreTransaction::CHANGED: 68 case PrefHashStoreTransaction::CHANGED:
72 UMA_HISTOGRAM_ENUMERATION( 69 histogram_name = user_prefs::tracked::kTrackedPrefHistogramChanged;
73 user_prefs::tracked::kTrackedPrefHistogramChanged, reporting_id_, 70 break;
74 reporting_ids_count_);
75 return;
76 case PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE: 71 case PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE:
77 UMA_HISTOGRAM_ENUMERATION( 72 histogram_name = user_prefs::tracked::kTrackedPrefHistogramInitialized;
78 user_prefs::tracked::kTrackedPrefHistogramInitialized, reporting_id_, 73 break;
79 reporting_ids_count_);
80 return;
81 case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE: 74 case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE:
82 UMA_HISTOGRAM_ENUMERATION( 75 histogram_name =
83 user_prefs::tracked::kTrackedPrefHistogramTrustedInitialized, 76 user_prefs::tracked::kTrackedPrefHistogramTrustedInitialized;
84 reporting_id_, reporting_ids_count_); 77 break;
85 return;
86 case PrefHashStoreTransaction::TRUSTED_NULL_VALUE: 78 case PrefHashStoreTransaction::TRUSTED_NULL_VALUE:
87 UMA_HISTOGRAM_ENUMERATION( 79 histogram_name =
88 user_prefs::tracked::kTrackedPrefHistogramNullInitialized, 80 user_prefs::tracked::kTrackedPrefHistogramNullInitialized;
89 reporting_id_, reporting_ids_count_); 81 break;
82 default:
83 NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: "
84 << value_state;
90 return; 85 return;
91 } 86 }
92 NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: " 87
93 << value_state; 88 std::string full_histogram_name(histogram_name);
89 if (!validation_type_suffix.empty())
90 full_histogram_name.append(".").append(validation_type_suffix);
91
92 // Using FactoryGet to allow dynamic histogram names. Should be equivalent to
gab 2016/08/08 04:37:47 s/Should be equivalent to/This is equivalent to/
proberge 2016/08/31 17:30:17 Done.
93 // UMA_HISTOGRAM_ENUMERATION(name, reporting_id_, reporting_ids_count_);
94 base::HistogramBase* histogram = base::LinearHistogram::FactoryGet(
95 full_histogram_name, 1, reporting_ids_count_, reporting_ids_count_ + 1,
96 base::HistogramBase::kUmaTargetedHistogramFlag);
97 histogram->Add(reporting_id_);
gab 2016/08/08 04:37:47 The change to introduce GetUMASuffix() and changin
proberge 2016/08/31 17:30:17 Acknowledged.
94 } 98 }
95 99
96 void TrackedPreferenceHelper::ReportAction(ResetAction reset_action) const { 100 void TrackedPreferenceHelper::ReportAction(ResetAction reset_action) const {
97 switch (reset_action) { 101 switch (reset_action) {
98 case DONT_RESET: 102 case DONT_RESET:
99 // No report for DONT_RESET. 103 // No report for DONT_RESET.
100 break; 104 break;
101 case WANTED_RESET: 105 case WANTED_RESET:
102 UMA_HISTOGRAM_ENUMERATION( 106 UMA_HISTOGRAM_ENUMERATION(
103 user_prefs::tracked::kTrackedPrefHistogramWantedReset, reporting_id_, 107 user_prefs::tracked::kTrackedPrefHistogramWantedReset, reporting_id_,
(...skipping 10 matching lines...) Expand all
114 size_t count) const { 118 size_t count) const {
115 // The histogram below is an expansion of the UMA_HISTOGRAM_COUNTS_100 macro 119 // The histogram below is an expansion of the UMA_HISTOGRAM_COUNTS_100 macro
116 // adapted to allow for a dynamically suffixed histogram name. 120 // adapted to allow for a dynamically suffixed histogram name.
117 // Note: The factory creates and owns the histogram. 121 // Note: The factory creates and owns the histogram.
118 base::HistogramBase* histogram = base::LinearHistogram::FactoryGet( 122 base::HistogramBase* histogram = base::LinearHistogram::FactoryGet(
119 user_prefs::tracked::kTrackedSplitPrefHistogramChanged + pref_path_, 1, 123 user_prefs::tracked::kTrackedSplitPrefHistogramChanged + pref_path_, 1,
120 100, // Allow counts up to 100. 124 100, // Allow counts up to 100.
121 101, base::HistogramBase::kUmaTargetedHistogramFlag); 125 101, base::HistogramBase::kUmaTargetedHistogramFlag);
122 histogram->Add(count); 126 histogram->Add(count);
123 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698