| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_ | 5 #ifndef SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_ |
| 6 #define SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_ | 6 #define SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 class Connection; | 39 class Connection; |
| 40 | 40 |
| 41 void SetValues(std::vector<mojom::PrefUpdatePtr> updates); | 41 void SetValues(std::vector<mojom::PrefUpdatePtr> updates); |
| 42 bool GetValue(const std::string& key, const base::Value** value) const; | 42 bool GetValue(const std::string& key, const base::Value** value) const; |
| 43 | 43 |
| 44 void CommitPendingWrite(base::OnceClosure done_callback); | 44 void CommitPendingWrite(base::OnceClosure done_callback); |
| 45 void SchedulePendingLossyWrites(); | 45 void SchedulePendingLossyWrites(); |
| 46 void ClearMutableValues(); | 46 void ClearMutableValues(); |
| 47 void OnStoreDeletionFromDisk(); |
| 47 | 48 |
| 48 // PrefStore::Observer: | 49 // PrefStore::Observer: |
| 49 void OnPrefValueChanged(const std::string& key) override; | 50 void OnPrefValueChanged(const std::string& key) override; |
| 50 void OnInitializationCompleted(bool succeeded) override; | 51 void OnInitializationCompleted(bool succeeded) override; |
| 51 | 52 |
| 52 void OnConnectionError(Connection* connection); | 53 void OnConnectionError(Connection* connection); |
| 53 | 54 |
| 54 scoped_refptr<PersistentPrefStore> backing_pref_store_; | 55 scoped_refptr<PersistentPrefStore> backing_pref_store_; |
| 55 | 56 |
| 56 bool initializing_ = false; | 57 bool initializing_ = false; |
| 57 | 58 |
| 58 std::unordered_map<Connection*, std::unique_ptr<Connection>> connections_; | 59 std::unordered_map<Connection*, std::unique_ptr<Connection>> connections_; |
| 59 | 60 |
| 60 base::OnceClosure on_initialized_; | 61 base::OnceClosure on_initialized_; |
| 61 | 62 |
| 62 // If true then a write is in progress and any update notifications should be | 63 // If true then a write is in progress and any update notifications should be |
| 63 // ignored, as those updates would originate from ourselves. | 64 // ignored, as those updates would originate from ourselves. |
| 64 bool write_in_progress_ = false; | 65 bool write_in_progress_ = false; |
| 65 | 66 |
| 66 DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreImpl); | 67 DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreImpl); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace prefs | 70 } // namespace prefs |
| 70 | 71 |
| 71 #endif // SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_ | 72 #endif // SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_ |
| OLD | NEW |