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

Unified Diff: chrome/browser/prefs/pref_metrics_service.cc

Issue 81683002: Prevent GetDeviceId from invoking its callback multiple times in failure cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +TODO Created 7 years, 1 month 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/prefs/pref_metrics_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_metrics_service.cc
diff --git a/chrome/browser/prefs/pref_metrics_service.cc b/chrome/browser/prefs/pref_metrics_service.cc
index 6d2476292a9c0bf037be468e18100b81e3f0c686..6bbfa4aa0a7e61e98e8097d4662c3c2a15046e41 100644
--- a/chrome/browser/prefs/pref_metrics_service.cc
+++ b/chrome/browser/prefs/pref_metrics_service.cc
@@ -263,10 +263,14 @@ void PrefMetricsService::LogIntegerPrefChange(int boundary_value,
}
void PrefMetricsService::GetDeviceIdCallback(const std::string& device_id) {
+#if !defined(OS_WIN) || defined(ENABLE_RLZ)
+ // A device_id is expected in all scenarios except when RLZ is disabled on
+ // Windows.
+ DCHECK(!device_id.empty());
+#endif
+
device_id_ = device_id;
- // On Aura, this seems to be called twice.
- if (!checked_tracked_prefs_)
- CheckTrackedPreferences();
+ CheckTrackedPreferences();
}
void PrefMetricsService::MarkNeedsEmptyValueForTrackedPreferences() {
@@ -289,7 +293,9 @@ void PrefMetricsService::MarkNeedsEmptyValueForTrackedPreferences() {
// profile. To make the system more resistant to spoofing, pref values are
// hashed with the pref path and the device id.
void PrefMetricsService::CheckTrackedPreferences() {
+ // Make sure this is only called once per instance of this service.
DCHECK(!checked_tracked_prefs_);
+ checked_tracked_prefs_ = true;
const base::DictionaryValue* pref_hash_dicts =
local_state_->GetDictionary(prefs::kProfilePreferenceHashes);
@@ -348,8 +354,6 @@ void PrefMetricsService::CheckTrackedPreferences() {
}
}
- checked_tracked_prefs_ = true;
-
// Now that we've checked the incoming preferences, register for change
// notifications, unless this is test code.
// TODO(bbudge) Fix failing browser_tests and so we can remove this test.
« no previous file with comments | « chrome/browser/prefs/pref_metrics_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698