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

Unified Diff: components/user_prefs/tracked/pref_hash_filter.cc

Issue 2297373002: Refactor PrefHashStore's BeginTransaction to take a rawptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments on #1 Created 4 years, 3 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 | « no previous file | components/user_prefs/tracked/pref_hash_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/user_prefs/tracked/pref_hash_filter.cc
diff --git a/components/user_prefs/tracked/pref_hash_filter.cc b/components/user_prefs/tracked/pref_hash_filter.cc
index 2f0c6e71f5f38fb0f878f5d0c3c64fb2207efe83..ee2115f614c49196747418b628f87d6b65739eb6 100644
--- a/components/user_prefs/tracked/pref_hash_filter.cc
+++ b/components/user_prefs/tracked/pref_hash_filter.cc
@@ -132,9 +132,9 @@ void PrefHashFilter::ClearResetTime(PrefService* user_prefs) {
}
void PrefHashFilter::Initialize(base::DictionaryValue* pref_store_contents) {
+ DictionaryHashStoreContents dictionary_contents(pref_store_contents);
std::unique_ptr<PrefHashStoreTransaction> hash_store_transaction(
- pref_hash_store_->BeginTransaction(std::unique_ptr<HashStoreContents>(
- new DictionaryHashStoreContents(pref_store_contents))));
+ pref_hash_store_->BeginTransaction(&dictionary_contents));
for (TrackedPreferencesMap::const_iterator it = tracked_paths_.begin();
it != tracked_paths_.end(); ++it) {
const std::string& initialized_path = it->first;
@@ -161,9 +161,9 @@ void PrefHashFilter::FilterSerializeData(
if (!changed_paths_.empty()) {
base::TimeTicks checkpoint = base::TimeTicks::Now();
{
+ DictionaryHashStoreContents dictionary_contents(pref_store_contents);
std::unique_ptr<PrefHashStoreTransaction> hash_store_transaction(
- pref_hash_store_->BeginTransaction(std::unique_ptr<HashStoreContents>(
- new DictionaryHashStoreContents(pref_store_contents))));
+ pref_hash_store_->BeginTransaction(&dictionary_contents));
for (ChangedPathsMap::const_iterator it = changed_paths_.begin();
it != changed_paths_.end(); ++it) {
const std::string& changed_path = it->first;
@@ -191,9 +191,9 @@ void PrefHashFilter::FinalizeFilterOnLoad(
bool did_reset = false;
{
+ DictionaryHashStoreContents dictionary_contents(pref_store_contents.get());
std::unique_ptr<PrefHashStoreTransaction> hash_store_transaction(
- pref_hash_store_->BeginTransaction(std::unique_ptr<HashStoreContents>(
- new DictionaryHashStoreContents(pref_store_contents.get()))));
+ pref_hash_store_->BeginTransaction(&dictionary_contents));
CleanupDeprecatedTrackedPreferences(
pref_store_contents.get(), hash_store_transaction.get());
« no previous file with comments | « no previous file | components/user_prefs/tracked/pref_hash_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698