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

Unified Diff: components/sync/driver/data_type_manager_impl.cc

Issue 2448863004: [Sync] Ensure RegisterWithBackend is only called for correct types (Closed)
Patch Set: Address Sky's comments. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/sync/driver/data_type_manager_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/driver/data_type_manager_impl.cc
diff --git a/components/sync/driver/data_type_manager_impl.cc b/components/sync/driver/data_type_manager_impl.cc
index ab6e637dbe97d5142ca8858da9e205fd05242986..84ace56b06d966bf0bae106603726ddd8b99b15b 100644
--- a/components/sync/driver/data_type_manager_impl.cc
+++ b/components/sync/driver/data_type_manager_impl.cc
@@ -166,8 +166,16 @@ void DataTypeManagerImpl::RegisterTypesWithBackend() {
for (auto type_iter = last_enabled_types_.First(); type_iter.Good();
type_iter.Inc()) {
const auto& dtc_iter = controllers_->find(type_iter.Get());
- if (dtc_iter != controllers_->end())
- dtc_iter->second->RegisterWithBackend(configurer_);
+ if (dtc_iter == controllers_->end())
+ continue;
+ DataTypeController* dtc = dtc_iter->second.get();
+ if (dtc->state() == DataTypeController::MODEL_LOADED) {
+ // Only call RegisterWithBackend for types that completed LoadModels
+ // successfully. Such types shouldn't be in an error state at the same
+ // time.
+ DCHECK(!data_type_status_table_.GetFailedTypes().Has(dtc->type()));
+ dtc->RegisterWithBackend(configurer_);
+ }
}
}
« no previous file with comments | « no previous file | components/sync/driver/data_type_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698