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

Side by Side Diff: components/policy/core/common/schema_registry.h

Issue 2915493002: Replace deprecated base::NonThreadSafe in components/policy in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/sequence_checker.h"
15 #include "components/policy/core/common/policy_namespace.h" 15 #include "components/policy/core/common/policy_namespace.h"
16 #include "components/policy/core/common/schema.h" 16 #include "components/policy/core/common/schema.h"
17 #include "components/policy/core/common/schema_map.h" 17 #include "components/policy/core/common/schema_map.h"
18 #include "components/policy/policy_export.h" 18 #include "components/policy/policy_export.h"
19 19
20 namespace policy { 20 namespace policy {
21 21
22 class SchemaMap; 22 class SchemaMap;
23 23
24 // Holds the main reference to the current SchemaMap, and allows a list of 24 // Holds the main reference to the current SchemaMap, and allows a list of
25 // observers to get notified whenever it is updated. 25 // observers to get notified whenever it is updated.
26 // This object is not thread safe and must be used from the owner's thread, 26 // This object is not thread safe and must be used from the owner's thread,
27 // usually UI. 27 // usually UI.
28 class POLICY_EXPORT SchemaRegistry : public base::NonThreadSafe { 28 class POLICY_EXPORT SchemaRegistry {
29 public: 29 public:
30 class POLICY_EXPORT Observer { 30 class POLICY_EXPORT Observer {
31 public: 31 public:
32 // Invoked whenever schemas are registered or unregistered. 32 // Invoked whenever schemas are registered or unregistered.
33 // |has_new_schemas| is true if a new component has been registered since 33 // |has_new_schemas| is true if a new component has been registered since
34 // the last update; this allows observers to ignore updates when 34 // the last update; this allows observers to ignore updates when
35 // components are unregistered but still get a handle to the current map 35 // components are unregistered but still get a handle to the current map
36 // (e.g. for periodic reloads). 36 // (e.g. for periodic reloads).
37 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) = 0; 37 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) = 0;
38 38
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 protected: 91 protected:
92 void Notify(bool has_new_schemas); 92 void Notify(bool has_new_schemas);
93 93
94 scoped_refptr<SchemaMap> schema_map_; 94 scoped_refptr<SchemaMap> schema_map_;
95 95
96 private: 96 private:
97 base::ObserverList<Observer, true> observers_; 97 base::ObserverList<Observer, true> observers_;
98 base::ObserverList<InternalObserver, true> internal_observers_; 98 base::ObserverList<InternalObserver, true> internal_observers_;
99 bool domains_ready_[POLICY_DOMAIN_SIZE]; 99 bool domains_ready_[POLICY_DOMAIN_SIZE];
100 100
101 SEQUENCE_CHECKER(sequence_checker_);
102
101 DISALLOW_COPY_AND_ASSIGN(SchemaRegistry); 103 DISALLOW_COPY_AND_ASSIGN(SchemaRegistry);
102 }; 104 };
103 105
104 // A registry that combines the maps of other registries. 106 // A registry that combines the maps of other registries.
105 class POLICY_EXPORT CombinedSchemaRegistry 107 class POLICY_EXPORT CombinedSchemaRegistry
106 : public SchemaRegistry, 108 : public SchemaRegistry,
107 public SchemaRegistry::Observer, 109 public SchemaRegistry::Observer,
108 public SchemaRegistry::InternalObserver { 110 public SchemaRegistry::InternalObserver {
109 public: 111 public:
110 CombinedSchemaRegistry(); 112 CombinedSchemaRegistry();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void UpdateReadiness(); 161 void UpdateReadiness();
160 162
161 SchemaRegistry* wrapped_; 163 SchemaRegistry* wrapped_;
162 164
163 DISALLOW_COPY_AND_ASSIGN(ForwardingSchemaRegistry); 165 DISALLOW_COPY_AND_ASSIGN(ForwardingSchemaRegistry);
164 }; 166 };
165 167
166 } // namespace policy 168 } // namespace policy
167 169
168 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ 170 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698