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

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

Issue 324493002: Move preference MACs to the protected preference stores. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove some now unnecessary changes. 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/pref_hash_filter.cc
diff --git a/chrome/browser/prefs/pref_hash_filter.cc b/chrome/browser/prefs/pref_hash_filter.cc
index 044fe18cd572365c59886cf16ba0d4275bfe2085..b5809b6a78d2c046faea29434f39b83e18697af0 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());
}
}
@@ -121,12 +121,12 @@ void PrefHashFilter::FilterUpdate(const std::string& path) {
// disk. This is required as storing the hash everytime a pref's value changes
// is too expensive (see perf regression @ 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.get()));
for (TrackedPreferencesMap::const_iterator it = tracked_paths_.begin();
it != tracked_paths_.end(); ++it) {
if (it->second->EnforceAndReport(pref_store_contents.get(),
@@ -179,6 +164,8 @@ void PrefHashFilter::FinalizeFilterOnLoad(
prefs_altered = true;
}
}
+ if (hash_store_transaction->StampSuperMac())
+ prefs_altered = true;
}
if (did_reset) {

Powered by Google App Engine
This is Rietveld 408576698