Chromium Code Reviews| Index: components/policy/core/common/schema_registry.cc |
| diff --git a/components/policy/core/common/schema_registry.cc b/components/policy/core/common/schema_registry.cc |
| index a773634a7009926a80c10c84a5c4152bf6cc0fb0..517259d997e798647b8378d87c285085e36dc7cc 100644 |
| --- a/components/policy/core/common/schema_registry.cc |
| +++ b/components/policy/core/common/schema_registry.cc |
| @@ -186,11 +186,13 @@ void CombinedSchemaRegistry::Combine(bool has_new_schemas) { |
| Notify(has_new_schemas); |
| } |
| -ForwardingSchemaRegistry::ForwardingSchemaRegistry(SchemaRegistry* wrapped) |
| - : wrapped_(wrapped) { |
| +ForwardingSchemaRegistry::ForwardingSchemaRegistry(SchemaRegistry* wrapped, |
| + bool forward_readiness) |
| + : wrapped_(wrapped), forward_readiness_(forward_readiness) { |
| schema_map_ = wrapped_->schema_map(); |
| wrapped_->AddObserver(this); |
| wrapped_->AddInternalObserver(this); |
| + UpdateReadiness(); |
| } |
| ForwardingSchemaRegistry::~ForwardingSchemaRegistry() { |
| @@ -222,6 +224,10 @@ void ForwardingSchemaRegistry::OnSchemaRegistryUpdated(bool has_new_schemas) { |
| Notify(has_new_schemas); |
| } |
| +void ForwardingSchemaRegistry::OnSchemaRegistryReady() { |
| + UpdateReadiness(); |
| +} |
| + |
| void ForwardingSchemaRegistry::OnSchemaRegistryShuttingDown( |
| SchemaRegistry* registry) { |
| DCHECK_EQ(wrapped_, registry); |
| @@ -231,4 +237,11 @@ void ForwardingSchemaRegistry::OnSchemaRegistryShuttingDown( |
| // Keep serving the same |schema_map_|. |
| } |
| +void ForwardingSchemaRegistry::UpdateReadiness() { |
|
Andrew T Wilson (Slow)
2016/10/28 14:49:56
How can UpdateReadiness() be called when wrapped_
emaxx
2016/10/31 15:51:20
You are right, check for NULL wrapped_ is unnecess
|
| + if (forward_readiness_ && wrapped_ && wrapped_->IsReady()) { |
| + for (int i = 0; i < POLICY_DOMAIN_SIZE; ++i) |
| + SetReady(static_cast<PolicyDomain>(i)); |
| + } |
| +} |
| + |
| } // namespace policy |