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

Side by Side Diff: chrome/browser/prefs/tracked/segregated_pref_store.cc

Issue 1148323005: Add the ability to schedule any pending lossy prefs to be written. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/prefs/tracked/segregated_pref_store.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prefs/tracked/segregated_pref_store.h" 5 #include "chrome/browser/prefs/tracked/segregated_pref_store.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 read_error_delegate_.reset(error_delegate); 143 read_error_delegate_.reset(error_delegate);
144 default_pref_store_->ReadPrefsAsync(NULL); 144 default_pref_store_->ReadPrefsAsync(NULL);
145 selected_pref_store_->ReadPrefsAsync(NULL); 145 selected_pref_store_->ReadPrefsAsync(NULL);
146 } 146 }
147 147
148 void SegregatedPrefStore::CommitPendingWrite() { 148 void SegregatedPrefStore::CommitPendingWrite() {
149 default_pref_store_->CommitPendingWrite(); 149 default_pref_store_->CommitPendingWrite();
150 selected_pref_store_->CommitPendingWrite(); 150 selected_pref_store_->CommitPendingWrite();
151 } 151 }
152 152
153 void SegregatedPrefStore::SchedulePendingLossyWrites() {
154 default_pref_store_->SchedulePendingLossyWrites();
155 selected_pref_store_->SchedulePendingLossyWrites();
156 }
157
153 SegregatedPrefStore::~SegregatedPrefStore() { 158 SegregatedPrefStore::~SegregatedPrefStore() {
154 default_pref_store_->RemoveObserver(&aggregating_observer_); 159 default_pref_store_->RemoveObserver(&aggregating_observer_);
155 selected_pref_store_->RemoveObserver(&aggregating_observer_); 160 selected_pref_store_->RemoveObserver(&aggregating_observer_);
156 } 161 }
157 162
158 PersistentPrefStore* SegregatedPrefStore::StoreForKey(const std::string& key) { 163 PersistentPrefStore* SegregatedPrefStore::StoreForKey(const std::string& key) {
159 return (ContainsKey(selected_preference_names_, key) 164 return (ContainsKey(selected_preference_names_, key)
160 ? selected_pref_store_ 165 ? selected_pref_store_
161 : default_pref_store_).get(); 166 : default_pref_store_).get();
162 } 167 }
163 168
164 const PersistentPrefStore* SegregatedPrefStore::StoreForKey( 169 const PersistentPrefStore* SegregatedPrefStore::StoreForKey(
165 const std::string& key) const { 170 const std::string& key) const {
166 return (ContainsKey(selected_preference_names_, key) 171 return (ContainsKey(selected_preference_names_, key)
167 ? selected_pref_store_ 172 ? selected_pref_store_
168 : default_pref_store_).get(); 173 : default_pref_store_).get();
169 } 174 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/tracked/segregated_pref_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698