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

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

Issue 254473002: Add support for int64 and uint64 in values.h's API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test compile Created 6 years, 8 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 | « base/values_unittest.cc ('k') | components/user_prefs/pref_registry_syncable.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_hash_filter.cc
diff --git a/chrome/browser/prefs/pref_hash_filter.cc b/chrome/browser/prefs/pref_hash_filter.cc
index e35df37edb45769367d2673f109a1097ab88b4e1..bf6e70081d7cea70dce7ceaf9ed565651b26fc5e 100644
--- a/chrome/browser/prefs/pref_hash_filter.cc
+++ b/chrome/browser/prefs/pref_hash_filter.cc
@@ -64,26 +64,15 @@ PrefHashFilter::~PrefHashFilter() {
void PrefHashFilter::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
// See GetResetTime for why this is a StringPref and not Int64Pref.
- registry->RegisterStringPref(
+ registry->RegisterInt64Pref(
prefs::kPreferenceResetTime,
- base::Int64ToString(base::Time().ToInternalValue()),
+ base::Time().ToInternalValue(),
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
}
// static
base::Time PrefHashFilter::GetResetTime(PrefService* user_prefs) {
- // Provide our own implementation (identical to the PrefService::GetInt64) in
- // order to ensure it remains consistent with the way we store this value
- // (which we do via a PrefStore, preventing us from reusing
- // PrefService::SetInt64).
- int64 internal_value = base::Time().ToInternalValue();
- if (!base::StringToInt64(
- user_prefs->GetString(prefs::kPreferenceResetTime),
- &internal_value)) {
- // Somehow the value stored on disk is not a valid int64.
- NOTREACHED();
- return base::Time();
- }
+ int64 internal_value = user_prefs->GetInt64(prefs::kPreferenceResetTime);
return base::Time::FromInternalValue(internal_value);
}
@@ -170,9 +159,8 @@ bool PrefHashFilter::FilterOnLoad(base::DictionaryValue* pref_store_contents) {
}
if (did_reset) {
- pref_store_contents->Set(prefs::kPreferenceResetTime,
- new base::StringValue(base::Int64ToString(
- base::Time::Now().ToInternalValue())));
+ pref_store_contents->SetInt64(prefs::kPreferenceResetTime,
+ base::Time::Now().ToInternalValue());
}
// TODO(gab): Remove this histogram by Feb 21 2014; after sufficient timing
« no previous file with comments | « base/values_unittest.cc ('k') | components/user_prefs/pref_registry_syncable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698