OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/prefs/tracked/pref_hash_filter.h" | 5 #include "chrome/browser/prefs/tracked/pref_hash_filter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // |pref_hash_store_| already. | 92 // |pref_hash_store_| already. |
93 DCHECK(changed_paths_.empty()); | 93 DCHECK(changed_paths_.empty()); |
94 } | 94 } |
95 | 95 |
96 // static | 96 // static |
97 void PrefHashFilter::RegisterProfilePrefs( | 97 void PrefHashFilter::RegisterProfilePrefs( |
98 user_prefs::PrefRegistrySyncable* registry) { | 98 user_prefs::PrefRegistrySyncable* registry) { |
99 // See GetResetTime for why this is a StringPref and not Int64Pref. | 99 // See GetResetTime for why this is a StringPref and not Int64Pref. |
100 registry->RegisterStringPref( | 100 registry->RegisterStringPref( |
101 prefs::kPreferenceResetTime, | 101 prefs::kPreferenceResetTime, |
102 base::Int64ToString(base::Time().ToInternalValue()), | 102 base::Int64ToString(base::Time().ToInternalValue())); |
103 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
104 } | 103 } |
105 | 104 |
106 // static | 105 // static |
107 base::Time PrefHashFilter::GetResetTime(PrefService* user_prefs) { | 106 base::Time PrefHashFilter::GetResetTime(PrefService* user_prefs) { |
108 // Provide our own implementation (identical to the PrefService::GetInt64) in | 107 // Provide our own implementation (identical to the PrefService::GetInt64) in |
109 // order to ensure it remains consistent with the way we store this value | 108 // order to ensure it remains consistent with the way we store this value |
110 // (which we do via a PrefStore, preventing us from reusing | 109 // (which we do via a PrefStore, preventing us from reusing |
111 // PrefService::SetInt64). | 110 // PrefService::SetInt64). |
112 int64 internal_value = base::Time().ToInternalValue(); | 111 int64 internal_value = base::Time().ToInternalValue(); |
113 if (!base::StringToInt64( | 112 if (!base::StringToInt64( |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 219 } |
221 | 220 |
222 // TODO(gab): Remove this histogram by Feb 21 2014; after sufficient timing | 221 // TODO(gab): Remove this histogram by Feb 21 2014; after sufficient timing |
223 // data has been gathered from the wild to be confident this doesn't | 222 // data has been gathered from the wild to be confident this doesn't |
224 // significantly affect startup. | 223 // significantly affect startup. |
225 UMA_HISTOGRAM_TIMES("Settings.FilterOnLoadTime", | 224 UMA_HISTOGRAM_TIMES("Settings.FilterOnLoadTime", |
226 base::TimeTicks::Now() - checkpoint); | 225 base::TimeTicks::Now() - checkpoint); |
227 | 226 |
228 post_filter_on_load_callback.Run(pref_store_contents.Pass(), prefs_altered); | 227 post_filter_on_load_callback.Run(pref_store_contents.Pass(), prefs_altered); |
229 } | 228 } |
OLD | NEW |