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

Unified Diff: chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc

Issue 329093003: Remove unloaded profile hash store initialization, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Combine three CLs. Created 6 years, 6 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
Index: chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc
diff --git a/chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc b/chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc
index 5482e3607bdba4da7291219a66c552d85ff8cb18..d464fd947684bfa6765b4d5217b6bb93b1dc4e19 100644
--- a/chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc
+++ b/chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc
@@ -59,7 +59,11 @@ const char PrefServiceHashStoreContents::kStoreVersionsDict[] =
PrefServiceHashStoreContents::PrefServiceHashStoreContents(
const std::string& hash_store_id,
PrefService* pref_service)
- : hash_store_id_(hash_store_id), pref_service_(pref_service) {}
+ : hash_store_id_(hash_store_id), pref_service_(pref_service) {
+ // TODO(erikwright): Remove in M40+.
+ DictionaryPrefUpdate update(pref_service_, prefs::kProfilePreferenceHashes);
+ update->RemovePath(kStoreVersionsDict, NULL);
+}
// static
void PrefServiceHashStoreContents::RegisterPrefs(PrefRegistrySimple* registry) {
@@ -83,17 +87,17 @@ void PrefServiceHashStoreContents::Reset() {
update->RemoveWithoutPathExpansion(hash_store_id_, NULL);
- // Remove this store's entry in the kStoreVersionsDict.
- base::DictionaryValue* version_dict;
- if (update->GetDictionary(kStoreVersionsDict, &version_dict))
- version_dict->RemoveWithoutPathExpansion(hash_store_id_, NULL);
-
// Remove this store's entry in the kHashOfHashesDict.
base::DictionaryValue* hash_of_hashes_dict;
if (update->GetDictionaryWithoutPathExpansion(kHashOfHashesDict,
&hash_of_hashes_dict)) {
hash_of_hashes_dict->RemoveWithoutPathExpansion(hash_store_id_, NULL);
+ if (hash_of_hashes_dict->empty())
+ update->RemovePath(kHashOfHashesDict, NULL);
}
+
+ if (update->empty())
+ pref_service_->ClearPref(prefs::kProfilePreferenceHashes);
}
bool PrefServiceHashStoreContents::IsInitialized() const {
@@ -103,21 +107,6 @@ bool PrefServiceHashStoreContents::IsInitialized() const {
NULL);
}
-bool PrefServiceHashStoreContents::GetVersion(int* version) const {
- DCHECK(version);
- const base::DictionaryValue* pref_hash_data =
- pref_service_->GetDictionary(prefs::kProfilePreferenceHashes);
-
- const base::DictionaryValue* version_dict;
- return pref_hash_data->GetDictionary(kStoreVersionsDict, &version_dict) &&
- version_dict->GetIntegerWithoutPathExpansion(hash_store_id_, version);
-}
-
-void PrefServiceHashStoreContents::SetVersion(int version) {
- PrefServiceMutableDictionary(kStoreVersionsDict, pref_service_)
- ->SetIntegerWithoutPathExpansion(hash_store_id_, version);
-}
-
const base::DictionaryValue* PrefServiceHashStoreContents::GetContents() const {
const base::DictionaryValue* pref_hash_dicts =
pref_service_->GetDictionary(prefs::kProfilePreferenceHashes);

Powered by Google App Engine
This is Rietveld 408576698