Index: base/prefs/json_pref_store.cc |
diff --git a/base/prefs/json_pref_store.cc b/base/prefs/json_pref_store.cc |
index a6c236261ba5d4426f2cff61bf398b8330302a9c..3eebff1486350dc5e8ed4be721716a6dc25a474c 100644 |
--- a/base/prefs/json_pref_store.cc |
+++ b/base/prefs/json_pref_store.cc |
@@ -297,8 +297,6 @@ void JsonPrefStore::RegisterOnNextSuccessfulWriteCallback( |
void JsonPrefStore::OnFileRead(scoped_ptr<base::Value> value, |
PersistentPrefStore::PrefReadError error, |
bool no_dir) { |
- scoped_ptr<base::DictionaryValue> unfiltered_prefs(new base::DictionaryValue); |
- |
read_error_ = error; |
bool initialization_successful = !no_dir; |
@@ -314,8 +312,7 @@ void JsonPrefStore::OnFileRead(scoped_ptr<base::Value> value, |
break; |
case PREF_READ_ERROR_NONE: |
DCHECK(value.get()); |
- unfiltered_prefs.reset( |
- static_cast<base::DictionaryValue*>(value.release())); |
+ prefs_.reset(static_cast<base::DictionaryValue*>(value.release())); |
break; |
case PREF_READ_ERROR_NO_FILE: |
// If the file just doesn't exist, maybe this is first run. In any case |
@@ -346,10 +343,9 @@ void JsonPrefStore::OnFileRead(scoped_ptr<base::Value> value, |
const PrefFilter::PostFilterOnLoadCallback post_filter_on_load_callback( |
base::Bind( |
&JsonPrefStore::FinalizeFileRead, this, initialization_successful)); |
gab
2014/06/06 21:54:58
This callback was using ref-counting simply to avo
erikwright (departed)
2014/06/10 14:25:36
This can be mitigated in other ways. For example,
gab
2014/06/10 16:54:33
For the comment to be added above, how about:
//
erikwright (departed)
2014/06/10 20:27:47
I agree that we don't need a Local State backed Pr
|
- pref_filter_->FilterOnLoad(post_filter_on_load_callback, |
- unfiltered_prefs.Pass()); |
+ pref_filter_->FilterOnLoad(post_filter_on_load_callback, prefs_.get()); |
} else { |
- FinalizeFileRead(initialization_successful, unfiltered_prefs.Pass(), false); |
+ FinalizeFileRead(initialization_successful, false); |
} |
} |
@@ -367,7 +363,6 @@ bool JsonPrefStore::SerializeData(std::string* output) { |
} |
void JsonPrefStore::FinalizeFileRead(bool initialization_successful, |
- scoped_ptr<base::DictionaryValue> prefs, |
bool schedule_write) { |
filtering_in_progress_ = false; |
@@ -378,8 +373,6 @@ void JsonPrefStore::FinalizeFileRead(bool initialization_successful, |
return; |
} |
- prefs_ = prefs.Pass(); |
- |
initialized_ = true; |
if (schedule_write && !read_only_) |