OLD | NEW |
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" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(CombinedSchemaRegistry); | 126 DISALLOW_COPY_AND_ASSIGN(CombinedSchemaRegistry); |
127 }; | 127 }; |
128 | 128 |
129 // A registry that wraps another schema registry. | 129 // A registry that wraps another schema registry. |
130 class POLICY_EXPORT ForwardingSchemaRegistry | 130 class POLICY_EXPORT ForwardingSchemaRegistry |
131 : public SchemaRegistry, | 131 : public SchemaRegistry, |
132 public SchemaRegistry::Observer, | 132 public SchemaRegistry::Observer, |
133 public SchemaRegistry::InternalObserver { | 133 public SchemaRegistry::InternalObserver { |
134 public: | 134 public: |
| 135 // If |forward_readiness| is true, then this registry will become ready as |
| 136 // soon as the wrapped registry gets ready. |
| 137 // |
135 // This registry will stop updating its SchemaMap when |wrapped| is | 138 // This registry will stop updating its SchemaMap when |wrapped| is |
136 // destroyed. | 139 // destroyed. |
137 explicit ForwardingSchemaRegistry(SchemaRegistry* wrapped); | 140 ForwardingSchemaRegistry(SchemaRegistry* wrapped, bool forward_readiness); |
138 ~ForwardingSchemaRegistry() override; | 141 ~ForwardingSchemaRegistry() override; |
139 | 142 |
140 // SchemaRegistry: | 143 // SchemaRegistry: |
141 void RegisterComponents(PolicyDomain domain, | 144 void RegisterComponents(PolicyDomain domain, |
142 const ComponentMap& components) override; | 145 const ComponentMap& components) override; |
143 void UnregisterComponent(const PolicyNamespace& ns) override; | 146 void UnregisterComponent(const PolicyNamespace& ns) override; |
144 | 147 |
145 // SchemaRegistry::Observer: | 148 // SchemaRegistry::Observer: |
146 void OnSchemaRegistryUpdated(bool has_new_schemas) override; | 149 void OnSchemaRegistryUpdated(bool has_new_schemas) override; |
| 150 void OnSchemaRegistryReady() override; |
147 | 151 |
148 // SchemaRegistry::InternalObserver: | 152 // SchemaRegistry::InternalObserver: |
149 void OnSchemaRegistryShuttingDown(SchemaRegistry* registry) override; | 153 void OnSchemaRegistryShuttingDown(SchemaRegistry* registry) override; |
150 | 154 |
151 private: | 155 private: |
| 156 void UpdateReadiness(); |
| 157 |
152 SchemaRegistry* wrapped_; | 158 SchemaRegistry* wrapped_; |
| 159 bool forward_readiness_; |
153 | 160 |
154 DISALLOW_COPY_AND_ASSIGN(ForwardingSchemaRegistry); | 161 DISALLOW_COPY_AND_ASSIGN(ForwardingSchemaRegistry); |
155 }; | 162 }; |
156 | 163 |
157 } // namespace policy | 164 } // namespace policy |
158 | 165 |
159 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ | 166 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_REGISTRY_H_ |
OLD | NEW |