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 | 8 |
9 namespace policy { | 9 namespace policy { |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 schema_map_ = new SchemaMap(map); | 48 schema_map_ = new SchemaMap(map); |
49 Notify(true); | 49 Notify(true); |
50 } | 50 } |
51 | 51 |
52 void SchemaRegistry::UnregisterComponent(const PolicyNamespace& ns) { | 52 void SchemaRegistry::UnregisterComponent(const PolicyNamespace& ns) { |
53 DomainMap map(schema_map_->GetDomains()); | 53 DomainMap map(schema_map_->GetDomains()); |
54 if (map[ns.domain].erase(ns.component_id) != 0) { | 54 if (map[ns.domain].erase(ns.component_id) != 0) { |
55 schema_map_ = new SchemaMap(map); | 55 schema_map_ = new SchemaMap(map); |
56 Notify(false); | 56 Notify(false); |
57 } else { | 57 } else { |
58 NOTREACHED(); | 58 // NOTREACHED(); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 bool SchemaRegistry::IsReady() const { | 62 bool SchemaRegistry::IsReady() const { |
63 for (int i = 0; i < POLICY_DOMAIN_SIZE; ++i) { | 63 for (int i = 0; i < POLICY_DOMAIN_SIZE; ++i) { |
64 if (!domains_ready_[i]) | 64 if (!domains_ready_[i]) |
65 return false; | 65 return false; |
66 } | 66 } |
67 return true; | 67 return true; |
68 } | 68 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 void ForwardingSchemaRegistry::OnSchemaRegistryShuttingDown( | 223 void ForwardingSchemaRegistry::OnSchemaRegistryShuttingDown( |
224 SchemaRegistry* registry) { | 224 SchemaRegistry* registry) { |
225 DCHECK_EQ(wrapped_, registry); | 225 DCHECK_EQ(wrapped_, registry); |
226 wrapped_->RemoveObserver(this); | 226 wrapped_->RemoveObserver(this); |
227 wrapped_->RemoveInternalObserver(this); | 227 wrapped_->RemoveInternalObserver(this); |
228 wrapped_ = NULL; | 228 wrapped_ = NULL; |
229 // Keep serving the same |schema_map_|. | 229 // Keep serving the same |schema_map_|. |
230 } | 230 } |
231 | 231 |
232 } // namespace policy | 232 } // namespace policy |
OLD | NEW |