OLD | NEW |
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 uint32 flags) override; | 91 uint32 flags) override; |
92 void RemoveValue(const std::string& key, uint32 flags) override; | 92 void RemoveValue(const std::string& key, uint32 flags) override; |
93 bool ReadOnly() const override; | 93 bool ReadOnly() const override; |
94 PrefReadError GetReadError() const override; | 94 PrefReadError GetReadError() const override; |
95 // Note this method may be asynchronous if this instance has a |pref_filter_| | 95 // Note this method may be asynchronous if this instance has a |pref_filter_| |
96 // in which case it will return PREF_READ_ERROR_ASYNCHRONOUS_TASK_INCOMPLETE. | 96 // in which case it will return PREF_READ_ERROR_ASYNCHRONOUS_TASK_INCOMPLETE. |
97 // See details in pref_filter.h. | 97 // See details in pref_filter.h. |
98 PrefReadError ReadPrefs() override; | 98 PrefReadError ReadPrefs() override; |
99 void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; | 99 void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; |
100 void CommitPendingWrite() override; | 100 void CommitPendingWrite() override; |
| 101 void SchedulePendingLossyWrites() override; |
101 void ReportValueChanged(const std::string& key, uint32 flags) override; | 102 void ReportValueChanged(const std::string& key, uint32 flags) override; |
102 | 103 |
103 // Just like RemoveValue(), but doesn't notify observers. Used when doing some | 104 // Just like RemoveValue(), but doesn't notify observers. Used when doing some |
104 // cleanup that shouldn't otherwise alert observers. | 105 // cleanup that shouldn't otherwise alert observers. |
105 void RemoveValueSilently(const std::string& key, uint32 flags); | 106 void RemoveValueSilently(const std::string& key, uint32 flags); |
106 | 107 |
107 // Registers |on_next_successful_write| to be called once, on the next | 108 // Registers |on_next_successful_write| to be called once, on the next |
108 // successful write event of |writer_|. | 109 // successful write event of |writer_|. |
109 void RegisterOnNextSuccessfulWriteCallback( | 110 void RegisterOnNextSuccessfulWriteCallback( |
110 const base::Closure& on_next_successful_write); | 111 const base::Closure& on_next_successful_write); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 const scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; | 202 const scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; |
202 | 203 |
203 scoped_ptr<base::DictionaryValue> prefs_; | 204 scoped_ptr<base::DictionaryValue> prefs_; |
204 | 205 |
205 bool read_only_; | 206 bool read_only_; |
206 | 207 |
207 // Helper for safely writing pref data. | 208 // Helper for safely writing pref data. |
208 base::ImportantFileWriter writer_; | 209 base::ImportantFileWriter writer_; |
209 | 210 |
210 scoped_ptr<PrefFilter> pref_filter_; | 211 scoped_ptr<PrefFilter> pref_filter_; |
211 ObserverList<PrefStore::Observer, true> observers_; | 212 base::ObserverList<PrefStore::Observer, true> observers_; |
212 | 213 |
213 scoped_ptr<ReadErrorDelegate> error_delegate_; | 214 scoped_ptr<ReadErrorDelegate> error_delegate_; |
214 | 215 |
215 bool initialized_; | 216 bool initialized_; |
216 bool filtering_in_progress_; | 217 bool filtering_in_progress_; |
217 bool pending_lossy_write_; | 218 bool pending_lossy_write_; |
218 PrefReadError read_error_; | 219 PrefReadError read_error_; |
219 | 220 |
220 std::set<std::string> keys_need_empty_value_; | 221 std::set<std::string> keys_need_empty_value_; |
221 | 222 |
222 WriteCountHistogram write_count_histogram_; | 223 WriteCountHistogram write_count_histogram_; |
223 | 224 |
224 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); | 225 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); |
225 }; | 226 }; |
226 | 227 |
227 #endif // BASE_PREFS_JSON_PREF_STORE_H_ | 228 #endif // BASE_PREFS_JSON_PREF_STORE_H_ |
OLD | NEW |