| Index: chrome/browser/prefs/tracked/segregated_pref_store.cc
|
| diff --git a/chrome/browser/prefs/tracked/segregated_pref_store.cc b/chrome/browser/prefs/tracked/segregated_pref_store.cc
|
| index a430d3035a8dfb2c3ad2d9edb8a3e8c5618356a7..d89a304b657d724586b45675a5c3aee732a14abf 100644
|
| --- a/chrome/browser/prefs/tracked/segregated_pref_store.cc
|
| +++ b/chrome/browser/prefs/tracked/segregated_pref_store.cc
|
| @@ -35,9 +35,6 @@ void SegregatedPrefStore::AggregatingObserver::OnInitializationCompleted(
|
| DCHECK_LE(failed_sub_initializations_ + successful_sub_initializations_, 2);
|
|
|
| if (failed_sub_initializations_ + successful_sub_initializations_ == 2) {
|
| - if (!outer_->on_initialization_.is_null())
|
| - outer_->on_initialization_.Run();
|
| -
|
| if (successful_sub_initializations_ == 2 && outer_->read_error_delegate_) {
|
| PersistentPrefStore::PrefReadError read_error = outer_->GetReadError();
|
| if (read_error != PersistentPrefStore::PREF_READ_ERROR_NONE)
|
| @@ -54,12 +51,10 @@ void SegregatedPrefStore::AggregatingObserver::OnInitializationCompleted(
|
| SegregatedPrefStore::SegregatedPrefStore(
|
| const scoped_refptr<PersistentPrefStore>& default_pref_store,
|
| const scoped_refptr<PersistentPrefStore>& selected_pref_store,
|
| - const std::set<std::string>& selected_pref_names,
|
| - const base::Closure& on_initialization)
|
| + const std::set<std::string>& selected_pref_names)
|
| : default_pref_store_(default_pref_store),
|
| selected_pref_store_(selected_pref_store),
|
| selected_preference_names_(selected_pref_names),
|
| - on_initialization_(on_initialization),
|
| aggregating_observer_(this) {
|
|
|
| default_pref_store_->AddObserver(&aggregating_observer_);
|
| @@ -150,34 +145,14 @@ SegregatedPrefStore::~SegregatedPrefStore() {
|
| selected_pref_store_->RemoveObserver(&aggregating_observer_);
|
| }
|
|
|
| +PersistentPrefStore* SegregatedPrefStore::StoreForKey(
|
| + const std::string& key) {
|
| + return ContainsKey(selected_preference_names_, key) ?
|
| + selected_pref_store_ : default_pref_store_;
|
| +}
|
| +
|
| const PersistentPrefStore* SegregatedPrefStore::StoreForKey(
|
| const std::string& key) const {
|
| - if (ContainsKey(selected_preference_names_, key) ||
|
| - selected_pref_store_->GetValue(key, NULL)) {
|
| - return selected_pref_store_.get();
|
| - }
|
| - return default_pref_store_.get();
|
| -}
|
| -
|
| -PersistentPrefStore* SegregatedPrefStore::StoreForKey(const std::string& key) {
|
| - if (ContainsKey(selected_preference_names_, key))
|
| - return selected_pref_store_.get();
|
| -
|
| - // Check if this unselected value was previously selected. If so, migrate it
|
| - // back to the unselected store.
|
| - // It's hard to do this in a single pass at startup because PrefStore does not
|
| - // permit us to enumerate its contents.
|
| - const base::Value* value = NULL;
|
| - if (selected_pref_store_->GetValue(key, &value)) {
|
| - default_pref_store_->SetValue(key, value->DeepCopy());
|
| - // Commit |default_pref_store_| to guarantee that the migrated value is
|
| - // flushed to disk before the removal from |selected_pref_store_| is
|
| - // eventually flushed to disk.
|
| - default_pref_store_->CommitPendingWrite();
|
| -
|
| - value = NULL;
|
| - selected_pref_store_->RemoveValue(key);
|
| - }
|
| -
|
| - return default_pref_store_.get();
|
| + return ContainsKey(selected_preference_names_, key) ?
|
| + selected_pref_store_ : default_pref_store_;
|
| }
|
|
|