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

Side by Side Diff: base/prefs/json_pref_store.h

Issue 1127963002: Implement lossy pref behavior for JsonPrefStore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs-fix-flags
Patch Set: 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 | « no previous file | base/prefs/json_pref_store.cc » ('j') | base/prefs/json_pref_store.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef BASE_PREFS_JSON_PREF_STORE_H_ 5 #ifndef BASE_PREFS_JSON_PREF_STORE_H_
6 #define BASE_PREFS_JSON_PREF_STORE_H_ 6 #define BASE_PREFS_JSON_PREF_STORE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // potentially been intercepted and modified by |pref_filter_|. 183 // potentially been intercepted and modified by |pref_filter_|.
184 // |initialization_successful| is pre-determined by OnFileRead() and should 184 // |initialization_successful| is pre-determined by OnFileRead() and should
185 // be used when reporting OnInitializationCompleted(). 185 // be used when reporting OnInitializationCompleted().
186 // |schedule_write| indicates whether a write should be immediately scheduled 186 // |schedule_write| indicates whether a write should be immediately scheduled
187 // (typically because the |pref_filter_| has already altered the |prefs|) -- 187 // (typically because the |pref_filter_| has already altered the |prefs|) --
188 // this will be ignored if this store is read-only. 188 // this will be ignored if this store is read-only.
189 void FinalizeFileRead(bool initialization_successful, 189 void FinalizeFileRead(bool initialization_successful,
190 scoped_ptr<base::DictionaryValue> prefs, 190 scoped_ptr<base::DictionaryValue> prefs,
191 bool schedule_write); 191 bool schedule_write);
192 192
193 // Schedule a write with the file writer as long as |flags| doesn't contain
194 // WriteablePrefStore::LOSSY_PREF_WRITE_FLAG.
195 void ScheduleWrite(uint32 flags);
196
193 const base::FilePath path_; 197 const base::FilePath path_;
194 const base::FilePath alternate_path_; 198 const base::FilePath alternate_path_;
195 const scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; 199 const scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_;
196 200
197 scoped_ptr<base::DictionaryValue> prefs_; 201 scoped_ptr<base::DictionaryValue> prefs_;
198 202
199 bool read_only_; 203 bool read_only_;
200 204
201 // Helper for safely writing pref data. 205 // Helper for safely writing pref data.
202 base::ImportantFileWriter writer_; 206 base::ImportantFileWriter writer_;
203 207
204 scoped_ptr<PrefFilter> pref_filter_; 208 scoped_ptr<PrefFilter> pref_filter_;
205 ObserverList<PrefStore::Observer, true> observers_; 209 ObserverList<PrefStore::Observer, true> observers_;
206 210
207 scoped_ptr<ReadErrorDelegate> error_delegate_; 211 scoped_ptr<ReadErrorDelegate> error_delegate_;
208 212
209 bool initialized_; 213 bool initialized_;
210 bool filtering_in_progress_; 214 bool filtering_in_progress_;
215 bool pending_lossy_write_;
211 PrefReadError read_error_; 216 PrefReadError read_error_;
212 217
213 std::set<std::string> keys_need_empty_value_; 218 std::set<std::string> keys_need_empty_value_;
214 219
215 WriteCountHistogram write_count_histogram_; 220 WriteCountHistogram write_count_histogram_;
216 221
217 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); 222 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore);
218 }; 223 };
219 224
220 #endif // BASE_PREFS_JSON_PREF_STORE_H_ 225 #endif // BASE_PREFS_JSON_PREF_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | base/prefs/json_pref_store.cc » ('j') | base/prefs/json_pref_store.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698