Chromium Code Reviews| 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 #include "components/policy/core/common/schema_registry.h" | 5 #include "components/policy/core/common/schema_registry.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "extensions/features/features.h" | 8 #include "extensions/features/features.h" |
| 9 | 9 |
| 10 namespace policy { | 10 namespace policy { |
| 11 | 11 |
| 12 SchemaRegistry::Observer::~Observer() {} | 12 SchemaRegistry::Observer::~Observer() {} |
| 13 | 13 |
| 14 SchemaRegistry::InternalObserver::~InternalObserver() {} | 14 SchemaRegistry::InternalObserver::~InternalObserver() {} |
| 15 | 15 |
| 16 SchemaRegistry::SchemaRegistry() : schema_map_(new SchemaMap) { | 16 SchemaRegistry::SchemaRegistry() : schema_map_(new SchemaMap) { |
| 17 for (int i = 0; i < POLICY_DOMAIN_SIZE; ++i) | 17 for (int i = 0; i < POLICY_DOMAIN_SIZE; ++i) |
| 18 domains_ready_[i] = false; | 18 domains_ready_[i] = false; |
| 19 #if !BUILDFLAG(ENABLE_EXTENSIONS) | 19 #if !BUILDFLAG(ENABLE_EXTENSIONS) |
| 20 SetExtensionsDomainsReady(); | 20 SetExtensionsDomainsReady(); |
| 21 #endif | 21 #endif |
| 22 } | 22 } |
| 23 | 23 |
| 24 SchemaRegistry::~SchemaRegistry() { | 24 SchemaRegistry::~SchemaRegistry() { |
| 25 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | |
|
emaxx
2017/05/30 10:54:39
(note for myself) We need to also add the DCHECKs
| |
| 25 for (auto& observer : internal_observers_) | 26 for (auto& observer : internal_observers_) |
| 26 observer.OnSchemaRegistryShuttingDown(this); | 27 observer.OnSchemaRegistryShuttingDown(this); |
| 27 } | 28 } |
| 28 | 29 |
| 29 void SchemaRegistry::RegisterComponent(const PolicyNamespace& ns, | 30 void SchemaRegistry::RegisterComponent(const PolicyNamespace& ns, |
| 30 const Schema& schema) { | 31 const Schema& schema) { |
| 31 ComponentMap map; | 32 ComponentMap map; |
| 32 map[ns.component_id] = schema; | 33 map[ns.component_id] = schema; |
| 33 RegisterComponents(ns.domain, map); | 34 RegisterComponents(ns.domain, map); |
| 34 } | 35 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 wrapped_ = NULL; | 245 wrapped_ = NULL; |
| 245 // Keep serving the same |schema_map_|. | 246 // Keep serving the same |schema_map_|. |
| 246 } | 247 } |
| 247 | 248 |
| 248 void ForwardingSchemaRegistry::UpdateReadiness() { | 249 void ForwardingSchemaRegistry::UpdateReadiness() { |
| 249 if (wrapped_->IsReady()) | 250 if (wrapped_->IsReady()) |
| 250 SetAllDomainsReady(); | 251 SetAllDomainsReady(); |
| 251 } | 252 } |
| 252 | 253 |
| 253 } // namespace policy | 254 } // namespace policy |
| OLD | NEW |