Index: base/prefs/json_pref_store.h |
diff --git a/base/prefs/json_pref_store.h b/base/prefs/json_pref_store.h |
index 1badcf2257ca3c3c8e058c4a55fd80e657a5e12d..ef260eb47da00b913918031bd55ed5b80978664a 100644 |
--- a/base/prefs/json_pref_store.h |
+++ b/base/prefs/json_pref_store.h |
@@ -29,6 +29,7 @@ class Clock; |
class DictionaryValue; |
class FilePath; |
class HistogramBase; |
+class JsonPrefStoreLossyWriteTest; |
class SequencedTaskRunner; |
class SequencedWorkerPool; |
class Value; |
@@ -82,9 +83,13 @@ class BASE_PREFS_EXPORT JsonPrefStore |
// PersistentPrefStore overrides: |
bool GetMutableValue(const std::string& key, base::Value** result) override; |
- void SetValue(const std::string& key, base::Value* value) override; |
- void SetValueSilently(const std::string& key, base::Value* value) override; |
- void RemoveValue(const std::string& key) override; |
+ void SetValue(const std::string& key, |
+ base::Value* value, |
+ uint32 flags) override; |
+ void SetValueSilently(const std::string& key, |
+ base::Value* value, |
+ uint32 flags) override; |
+ void RemoveValue(const std::string& key, uint32 flags) override; |
bool ReadOnly() const override; |
PrefReadError GetReadError() const override; |
// Note this method may be asynchronous if this instance has a |pref_filter_| |
@@ -93,11 +98,11 @@ class BASE_PREFS_EXPORT JsonPrefStore |
PrefReadError ReadPrefs() override; |
void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; |
void CommitPendingWrite() override; |
- void ReportValueChanged(const std::string& key) override; |
+ void ReportValueChanged(const std::string& key, uint32 flags) override; |
// Just like RemoveValue(), but doesn't notify observers. Used when doing some |
// cleanup that shouldn't otherwise alert observers. |
- void RemoveValueSilently(const std::string& key); |
+ void RemoveValueSilently(const std::string& key, uint32 flags); |
// Registers |on_next_successful_write| to be called once, on the next |
// successful write event of |writer_|. |
@@ -161,6 +166,7 @@ class BASE_PREFS_EXPORT JsonPrefStore |
WriteCountHistogramTestMultiplePeriods); |
FRIEND_TEST_ALL_PREFIXES(base::JsonPrefStoreTest, |
WriteCountHistogramTestPeriodWithGaps); |
+ friend class base::JsonPrefStoreLossyWriteTest; |
~JsonPrefStore() override; |
@@ -186,6 +192,10 @@ class BASE_PREFS_EXPORT JsonPrefStore |
scoped_ptr<base::DictionaryValue> prefs, |
bool schedule_write); |
+ // Schedule a write with the file writer as long as |flags| doesn't contain |
+ // WriteablePrefStore::LOSSY_PREF_WRITE_FLAG. |
+ void ScheduleWrite(uint32 flags); |
+ |
const base::FilePath path_; |
const base::FilePath alternate_path_; |
const scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; |
@@ -204,6 +214,7 @@ class BASE_PREFS_EXPORT JsonPrefStore |
bool initialized_; |
bool filtering_in_progress_; |
+ bool pending_lossy_write_; |
PrefReadError read_error_; |
std::set<std::string> keys_need_empty_value_; |