| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_PREFS_LEVELDB_PREF_STORE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_LEVELDB_PREF_STORE_H_ |
| 6 #define CHROME_BROWSER_PREFS_LEVELDB_PREF_STORE_H_ | 6 #define CHROME_BROWSER_PREFS_LEVELDB_PREF_STORE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // A writable PrefStore implementation that is used for user preferences. | 31 // A writable PrefStore implementation that is used for user preferences. |
| 32 class LevelDBPrefStore : public PersistentPrefStore { | 32 class LevelDBPrefStore : public PersistentPrefStore { |
| 33 public: | 33 public: |
| 34 // |sequenced_task_runner| is must be a shutdown-blocking task runner, ideally | 34 // |sequenced_task_runner| is must be a shutdown-blocking task runner, ideally |
| 35 // created by GetTaskRunnerForFile() method above. | 35 // created by GetTaskRunnerForFile() method above. |
| 36 LevelDBPrefStore(const base::FilePath& pref_filename, | 36 LevelDBPrefStore(const base::FilePath& pref_filename, |
| 37 base::SequencedTaskRunner* sequenced_task_runner); | 37 base::SequencedTaskRunner* sequenced_task_runner); |
| 38 | 38 |
| 39 // PrefStore overrides: | 39 // PrefStore overrides: |
| 40 virtual bool GetValue(const std::string& key, | 40 virtual bool GetValue(const std::string& key, |
| 41 const base::Value** result) const OVERRIDE; | 41 const base::Value** result) const override; |
| 42 virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; | 42 virtual void AddObserver(PrefStore::Observer* observer) override; |
| 43 virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; | 43 virtual void RemoveObserver(PrefStore::Observer* observer) override; |
| 44 virtual bool HasObservers() const OVERRIDE; | 44 virtual bool HasObservers() const override; |
| 45 virtual bool IsInitializationComplete() const OVERRIDE; | 45 virtual bool IsInitializationComplete() const override; |
| 46 | 46 |
| 47 // PersistentPrefStore overrides: | 47 // PersistentPrefStore overrides: |
| 48 virtual bool GetMutableValue(const std::string& key, | 48 virtual bool GetMutableValue(const std::string& key, |
| 49 base::Value** result) OVERRIDE; | 49 base::Value** result) override; |
| 50 // Takes ownership of value. | 50 // Takes ownership of value. |
| 51 virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE; | 51 virtual void SetValue(const std::string& key, base::Value* value) override; |
| 52 virtual void SetValueSilently(const std::string& key, | 52 virtual void SetValueSilently(const std::string& key, |
| 53 base::Value* value) OVERRIDE; | 53 base::Value* value) override; |
| 54 virtual void RemoveValue(const std::string& key) OVERRIDE; | 54 virtual void RemoveValue(const std::string& key) override; |
| 55 virtual bool ReadOnly() const OVERRIDE; | 55 virtual bool ReadOnly() const override; |
| 56 virtual PrefReadError GetReadError() const OVERRIDE; | 56 virtual PrefReadError GetReadError() const override; |
| 57 virtual PrefReadError ReadPrefs() OVERRIDE; | 57 virtual PrefReadError ReadPrefs() override; |
| 58 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) OVERRIDE; | 58 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; |
| 59 virtual void CommitPendingWrite() OVERRIDE; | 59 virtual void CommitPendingWrite() override; |
| 60 virtual void ReportValueChanged(const std::string& key) OVERRIDE; | 60 virtual void ReportValueChanged(const std::string& key) override; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 struct ReadingResults; | 63 struct ReadingResults; |
| 64 class FileThreadSerializer; | 64 class FileThreadSerializer; |
| 65 | 65 |
| 66 virtual ~LevelDBPrefStore(); | 66 virtual ~LevelDBPrefStore(); |
| 67 | 67 |
| 68 static scoped_ptr<ReadingResults> DoReading(const base::FilePath& path); | 68 static scoped_ptr<ReadingResults> DoReading(const base::FilePath& path); |
| 69 static void OpenDB(const base::FilePath& path, | 69 static void OpenDB(const base::FilePath& path, |
| 70 ReadingResults* reading_results); | 70 ReadingResults* reading_results); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 std::set<std::string> keys_to_delete_; | 107 std::set<std::string> keys_to_delete_; |
| 108 std::map<std::string, std::string> keys_to_set_; | 108 std::map<std::string, std::string> keys_to_set_; |
| 109 base::OneShotTimer<LevelDBPrefStore> timer_; | 109 base::OneShotTimer<LevelDBPrefStore> timer_; |
| 110 | 110 |
| 111 base::WeakPtrFactory<LevelDBPrefStore> weak_ptr_factory_; | 111 base::WeakPtrFactory<LevelDBPrefStore> weak_ptr_factory_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(LevelDBPrefStore); | 113 DISALLOW_COPY_AND_ASSIGN(LevelDBPrefStore); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 #endif // CHROME_BROWSER_PREFS_LEVELDB_PREF_STORE_H_ | 116 #endif // CHROME_BROWSER_PREFS_LEVELDB_PREF_STORE_H_ |
| OLD | NEW |