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_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_ | 5 #ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_ |
6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_ | 6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 protected: | 59 protected: |
60 // base::RefCounted<PrefStore>: | 60 // base::RefCounted<PrefStore>: |
61 ~PersistentPrefStoreClient() override; | 61 ~PersistentPrefStoreClient() override; |
62 | 62 |
63 private: | 63 private: |
64 void OnConnect(mojom::PersistentPrefStoreConnectionPtr connection, | 64 void OnConnect(mojom::PersistentPrefStoreConnectionPtr connection, |
65 std::unordered_map<PrefValueStore::PrefStoreType, | 65 std::unordered_map<PrefValueStore::PrefStoreType, |
66 prefs::mojom::PrefStoreConnectionPtr> | 66 prefs::mojom::PrefStoreConnectionPtr> |
67 other_pref_stores); | 67 other_pref_stores); |
68 | 68 |
| 69 void QueueWrite(const std::string& key, uint32_t flags); |
| 70 void FlushPendingWrites(); |
| 71 |
69 mojom::PrefStoreConnectorPtr connector_; | 72 mojom::PrefStoreConnectorPtr connector_; |
70 scoped_refptr<PrefRegistry> pref_registry_; | 73 scoped_refptr<PrefRegistry> pref_registry_; |
71 bool read_only_ = false; | 74 bool read_only_ = false; |
72 PrefReadError read_error_ = PersistentPrefStore::PREF_READ_ERROR_NONE; | 75 PrefReadError read_error_ = PersistentPrefStore::PREF_READ_ERROR_NONE; |
73 mojom::PersistentPrefStorePtr pref_store_; | 76 mojom::PersistentPrefStorePtr pref_store_; |
| 77 std::map<std::string, uint32_t> pending_writes_; |
74 | 78 |
75 std::unique_ptr<ReadErrorDelegate> error_delegate_; | 79 std::unique_ptr<ReadErrorDelegate> error_delegate_; |
76 std::vector<PrefValueStore::PrefStoreType> already_connected_types_; | 80 std::vector<PrefValueStore::PrefStoreType> already_connected_types_; |
77 | 81 |
| 82 base::WeakPtrFactory<PersistentPrefStoreClient> weak_factory_; |
| 83 |
78 DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreClient); | 84 DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreClient); |
79 }; | 85 }; |
80 | 86 |
81 } // namespace prefs | 87 } // namespace prefs |
82 | 88 |
83 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_ | 89 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PERSISTENT_PREF_STORE_CLIENT_H_ |
OLD | NEW |