Chromium Code Reviews| Index: chrome/browser/prefs/profile_pref_store_manager.cc |
| diff --git a/chrome/browser/prefs/profile_pref_store_manager.cc b/chrome/browser/prefs/profile_pref_store_manager.cc |
| index 2800ec0f696694680c3aaf91b59b06a487124c61..db77936b6bfc8940bf837df34b86f22b6bd6662d 100644 |
| --- a/chrome/browser/prefs/profile_pref_store_manager.cc |
| +++ b/chrome/browser/prefs/profile_pref_store_manager.cc |
| @@ -64,8 +64,6 @@ class DictionaryHashStoreContents : public HashStoreContents { |
| super_mac_ = super_mac; |
| } |
| - virtual void CommitPendingWrite() OVERRIDE {} |
| - |
| private: |
| class SimpleMutableDictionary |
| : public HashStoreContents::MutableDictionary { |
| @@ -211,12 +209,12 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( |
| } |
| scoped_ptr<PrefHashFilter> unprotected_pref_hash_filter( |
| - new PrefHashFilter(GetPrefHashStoreImpl().PassAs<PrefHashStore>(), |
| + new PrefHashFilter(GetPrefHashStoreImpl(false).PassAs<PrefHashStore>(), |
| unprotected_configuration, |
| validation_delegate, |
| reporting_ids_count_)); |
| scoped_ptr<PrefHashFilter> protected_pref_hash_filter( |
| - new PrefHashFilter(GetPrefHashStoreImpl().PassAs<PrefHashStore>(), |
| + new PrefHashFilter(GetPrefHashStoreImpl(true).PassAs<PrefHashStore>(), |
| protected_configuration, |
| validation_delegate, |
| reporting_ids_count_)); |
| @@ -246,6 +244,10 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( |
| unprotected_pref_store->AsWeakPtr()), |
| base::Bind(&JsonPrefStore::RegisterOnNextSuccessfulWriteCallback, |
| protected_pref_store->AsWeakPtr()), |
| + GetPrefHashStoreImpl(false).PassAs<PrefHashStore>(), |
| + GetPrefHashStoreImpl(true).PassAs<PrefHashStore>(), |
| + scoped_ptr<HashStoreContents>(new PrefServiceHashStoreContents( |
| + profile_path_.AsUTF8Unsafe(), local_state_)), |
| raw_unprotected_pref_hash_filter, |
| raw_protected_pref_hash_filter); |
| @@ -260,6 +262,18 @@ bool ProfilePrefStoreManager::InitializePrefsFromMasterPrefs( |
| if (!base::CreateDirectory(profile_path_)) |
| return false; |
| + const base::DictionaryValue* to_serialize = &master_prefs; |
| + scoped_ptr<base::DictionaryValue> copy; |
| + |
| + if (kPlatformSupportsPreferenceTracking) { |
| + copy.reset(master_prefs.DeepCopy()); |
| + to_serialize = copy.get(); |
| + PrefHashFilter(GetPrefHashStoreImpl(false).PassAs<PrefHashStore>(), |
| + tracking_configuration_, |
| + NULL, |
| + reporting_ids_count_).Initialize(copy.get()); |
|
gab
2014/06/13 01:57:43
s/copy.get()/to_serialize
erikwright (departed)
2014/06/16 20:51:26
Can't. |copy| is non-const, whereas |to_serialize|
|
| + } |
| + |
| // This will write out to a single combined file which will be immediately |
| // migrated to two files on load. |
| JSONFileValueSerializer serializer( |
| @@ -270,44 +284,18 @@ bool ProfilePrefStoreManager::InitializePrefsFromMasterPrefs( |
| // complete before Chrome can start (as master preferences seed the Local |
| // State and Preferences files). This won't trip ThreadIORestrictions as they |
| // won't have kicked in yet on the main thread. |
| - bool success = serializer.Serialize(master_prefs); |
| - |
| - if (success && kPlatformSupportsPreferenceTracking) { |
| - scoped_refptr<const PrefStore> pref_store( |
| - new DictionaryPrefStore(&master_prefs)); |
| - PrefHashFilter(GetPrefHashStoreImpl().PassAs<PrefHashStore>(), |
| - tracking_configuration_, |
| - NULL, |
| - reporting_ids_count_).Initialize(*pref_store); |
| - } |
| + bool success = serializer.Serialize(*to_serialize); |
| UMA_HISTOGRAM_BOOLEAN("Settings.InitializedFromMasterPrefs", success); |
| return success; |
| } |
| -PersistentPrefStore* |
| -ProfilePrefStoreManager::CreateDeprecatedCombinedProfilePrefStore( |
| - const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) { |
| - scoped_ptr<PrefFilter> pref_filter; |
| - if (kPlatformSupportsPreferenceTracking) { |
| - pref_filter.reset( |
| - new PrefHashFilter(GetPrefHashStoreImpl().PassAs<PrefHashStore>(), |
| - tracking_configuration_, |
| - NULL, |
| - reporting_ids_count_)); |
| - } |
| - return new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_), |
| - io_task_runner, |
| - pref_filter.Pass()); |
| -} |
| - |
| -scoped_ptr<PrefHashStoreImpl> ProfilePrefStoreManager::GetPrefHashStoreImpl() { |
| +scoped_ptr<PrefHashStoreImpl> ProfilePrefStoreManager::GetPrefHashStoreImpl( |
|
gab
2014/06/13 01:57:43
Rename this method to GetPrefHashStore() and retur
erikwright (departed)
2014/06/16 20:51:27
Done.
|
| + bool use_super_mac) { |
| DCHECK(kPlatformSupportsPreferenceTracking); |
| return make_scoped_ptr(new PrefHashStoreImpl( |
| seed_, |
| device_id_, |
| - scoped_ptr<HashStoreContents>(new PrefServiceHashStoreContents( |
| - profile_path_.AsUTF8Unsafe(), local_state_)), |
| - true)); |
| + use_super_mac)); |
| } |