Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Side by Side Diff: services/preferences/persistent_pref_store_impl.h

Issue 2743563003: Pref service: add persistent pref store frontend and backend. (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/preferences/DEPS ('k') | services/preferences/persistent_pref_store_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_
6 #define SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_
7
8 #include <memory>
9 #include <string>
10 #include <unordered_map>
11 #include <vector>
12
13 #include "base/macros.h"
14 #include "services/preferences/public/interfaces/preferences.mojom.h"
15 #include "services/preferences/public/interfaces/tracked_preference_validation_d elegate.mojom.h"
16
17 namespace base {
18 class Value;
19 }
20
21 namespace prefs {
22
23 class PersistentPrefStoreImpl : public mojom::PersistentPrefStoreConnector,
24 public PrefStore::Observer {
25 public:
26 PersistentPrefStoreImpl(
27 scoped_refptr<PersistentPrefStore> backing_pref_store,
28 mojom::TrackedPreferenceValidationDelegatePtr validation_delegate);
29
30 ~PersistentPrefStoreImpl() override;
31
32 // mojom::PersistentPrefStoreConnector override:
33 void Connect(const ConnectCallback& callback) override;
34
35 private:
36 class Connection;
37
38 void SetValue(const std::string& key,
39 std::unique_ptr<base::Value> value,
40 uint32_t flags);
41
42 void CommitPendingWrite();
43 void SchedulePendingLossyWrites();
44 void ClearMutableValues();
45
46 // PrefStore::Observer:
47 void OnPrefValueChanged(const std::string& key) override;
48 void OnInitializationCompleted(bool succeeded) override;
49
50 void CallConnectCallback(
51 const mojom::PersistentPrefStoreConnector::ConnectCallback& callback);
52 void OnConnectionError(Connection* connection);
53
54 scoped_refptr<PersistentPrefStore> backing_pref_store_;
55 mojom::TrackedPreferenceValidationDelegatePtr validation_delegate_;
56
57 bool initializing_ = false;
58 std::vector<ConnectCallback> pending_connect_callbacks_;
59
60 std::unordered_map<Connection*, std::unique_ptr<Connection>> connections_;
61
62 DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreImpl);
63 };
64
65 } // namespace prefs
66
67 #endif // SERVICES_PREFERENCES_PERSISTENT_PREF_STORE_IMPL_H_
OLDNEW
« no previous file with comments | « services/preferences/DEPS ('k') | services/preferences/persistent_pref_store_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698