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 bd35e293046fb3f7a9d1183eed5490b7339873dc..8fb28447b0736a9a48ec2c5c6a6cbed07d7a648c 100644 |
--- a/chrome/browser/prefs/pref_hash_filter.cc |
+++ b/chrome/browser/prefs/pref_hash_filter.cc |
@@ -96,15 +96,15 @@ void PrefHashFilter::ClearResetTime(PrefService* user_prefs) { |
user_prefs->ClearPref(prefs::kPreferenceResetTime); |
} |
-void PrefHashFilter::Initialize(const PrefStore& pref_store) { |
+void PrefHashFilter::Initialize(base::DictionaryValue* pref_store_contents) { |
scoped_ptr<PrefHashStoreTransaction> hash_store_transaction( |
- pref_hash_store_->BeginTransaction()); |
+ pref_hash_store_->BeginTransaction(pref_store_contents)); |
for (TrackedPreferencesMap::const_iterator it = tracked_paths_.begin(); |
it != tracked_paths_.end(); ++it) { |
const std::string& initialized_path = it->first; |
const TrackedPreference* initialized_preference = it->second; |
const base::Value* value = NULL; |
- pref_store.GetValue(initialized_path, &value); |
+ pref_store_contents->Get(initialized_path, &value); |
initialized_preference->OnNewValue(value, hash_store_transaction.get()); |
} |
} |
@@ -119,14 +119,14 @@ void PrefHashFilter::FilterUpdate(const std::string& path) { |
// Updates the stored hashes for |changed_paths_| before serializing data to |
// disk. This is required as storing the hash everytime a pref's value changes |
-// is too expensive (see perf regression @ http://crbug.com/331273). |
+// is too expensive (see perf roegression @ http://crbug.com/331273). |
void PrefHashFilter::FilterSerializeData( |
- const base::DictionaryValue* pref_store_contents) { |
+ base::DictionaryValue* pref_store_contents) { |
if (!changed_paths_.empty()) { |
base::TimeTicks checkpoint = base::TimeTicks::Now(); |
{ |
scoped_ptr<PrefHashStoreTransaction> hash_store_transaction( |
- pref_hash_store_->BeginTransaction()); |
+ pref_hash_store_->BeginTransaction(pref_store_contents)); |
for (ChangedPathsMap::const_iterator it = changed_paths_.begin(); |
it != changed_paths_.end(); ++it) { |
const std::string& changed_path = it->first; |
@@ -143,21 +143,6 @@ void PrefHashFilter::FilterSerializeData( |
UMA_HISTOGRAM_TIMES("Settings.FilterSerializeDataTime", |
base::TimeTicks::Now() - checkpoint); |
} |
- |
- // Flush the |pref_hash_store_| to disk if it has pending writes. This is done |
- // here in an effort to flush the hash store to disk as close as possible to |
- // its matching value store (currently being flushed) to reduce the likelihood |
- // of MAC corruption in race condition scenarios where a crash occurs in the |
- // 10 seconds window where it would typically be possible that only one |
- // of the two stores has been flushed to disk (this now explicitly makes this |
- // race window as small as possible). |
- // Note that, if the |pref_hash_store_| has pending writes, this call will |
- // force serialization of its store to disk. As FilterSerializeData is already |
- // intercepting the serialization of its value store this would result in an |
- // infinite loop should the hash store also be the value store -- thus this |
- // should be removed when we move to such a model (where it will no longer be |
- // necessary anyways). |
- pref_hash_store_->CommitPendingWrite(); |
} |
void PrefHashFilter::FinalizeFilterOnLoad( |
@@ -170,7 +155,7 @@ void PrefHashFilter::FinalizeFilterOnLoad( |
bool did_reset = false; |
{ |
scoped_ptr<PrefHashStoreTransaction> hash_store_transaction( |
- pref_hash_store_->BeginTransaction()); |
+ pref_hash_store_->BeginTransaction(pref_store_contents)); |
for (TrackedPreferencesMap::const_iterator it = tracked_paths_.begin(); |
it != tracked_paths_.end(); ++it) { |
if (it->second->EnforceAndReport(pref_store_contents, |