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

Unified Diff: components/sync_driver/data_type_manager_impl.cc

Issue 439903002: [Sync] Move reenable logic into DTM (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix dcheck Created 6 years, 4 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
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 77545aa34359ae8e654ed705c80142306b16c8bf..936a745e5669b92ea343d8415a2e9575bca586fe 100644
--- a/components/sync_driver/data_type_manager_impl.cc
+++ b/components/sync_driver/data_type_manager_impl.cc
@@ -111,6 +111,25 @@ void DataTypeManagerImpl::Configure(syncer::ModelTypeSet desired_types,
ConfigureImpl(filtered_desired_types, reason);
}
+void DataTypeManagerImpl::ReenableType(syncer::ModelType type) {
+ // TODO(zea): move the "should we reconfigure" logic into the datatype handler
+ // itself.
+ // Only reconfigure if the type actually had a data type or unready error.
+ if (!failed_data_types_handler_->ResetDataTypeErrorFor(type) &&
+ !failed_data_types_handler_->ResetUnreadyErrorFor(type)) {
+ return;
+ }
+
+ // Only reconfigure if the type is actually desired.
+ if (!last_requested_types_.Has(type))
+ return;
+
+ DVLOG(1) << "Reenabling " << syncer::ModelTypeToString(type);
+ needs_reconfigure_ = true;
+ last_configure_reason_ = syncer::CONFIGURE_REASON_PROGRAMMATIC;
+ ProcessReconfigure();
+}
+
void DataTypeManagerImpl::PurgeForMigration(
syncer::ModelTypeSet undesired_types,
syncer::ConfigureReason reason) {
@@ -419,6 +438,7 @@ void DataTypeManagerImpl::OnSingleDataTypeWillStop(
// reconfigure.
if (error.error_type() != syncer::SyncError::UNRECOVERABLE_ERROR) {
needs_reconfigure_ = true;
+ last_configure_reason_ = syncer::CONFIGURE_REASON_PROGRAMMATIC;
ProcessReconfigure();
} else {
DCHECK_EQ(state_, CONFIGURING);
« no previous file with comments | « components/sync_driver/data_type_manager_impl.h ('k') | components/sync_driver/data_type_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698