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

Unified Diff: trunk/src/chrome/browser/sync/profile_sync_service.cc

Issue 465113002: Revert 288557 "[Sync] Use OnSingleDataTypeUnrecoverableError for..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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: trunk/src/chrome/browser/sync/profile_sync_service.cc
===================================================================
--- trunk/src/chrome/browser/sync/profile_sync_service.cc (revision 289111)
+++ trunk/src/chrome/browser/sync/profile_sync_service.cc (working copy)
@@ -951,6 +951,24 @@
syncer::DISABLE_SYNC : syncer::STOP_SYNC));
}
+// TODO(zea): Move this logic into the DataTypeController/DataTypeManager.
+void ProfileSyncService::DisableDatatype(const syncer::SyncError& error) {
+ // First deactivate the type so that no further server changes are
+ // passed onto the change processor.
+ DeactivateDataType(error.model_type());
+
+ std::map<syncer::ModelType, syncer::SyncError> errors;
+ errors[error.model_type()] = error;
+
+ // Update this before posting a task. So if a configure happens before
+ // the task that we are going to post, this type would still be disabled.
+ failed_data_types_handler_.UpdateFailedDataTypes(errors);
+
+ base::MessageLoop::current()->PostTask(FROM_HERE,
+ base::Bind(&ProfileSyncService::ReconfigureDatatypeManager,
+ weak_factory_.GetWeakPtr()));
+}
+
void ProfileSyncService::ReenableDatatype(syncer::ModelType type) {
// Only reconfigure if the type actually had a data type or unready error.
if (!failed_data_types_handler_.ResetDataTypeErrorFor(type) &&
@@ -1366,10 +1384,7 @@
syncer::SyncError::DATATYPE_POLICY_ERROR,
"Delete directives not supported with encryption.",
syncer::HISTORY_DELETE_DIRECTIVES);
- FailedDataTypesHandler::TypeErrorMap error_map;
- error_map[error.model_type()] = error;
- failed_data_types_handler_.UpdateFailedDataTypes(error_map);
- ReconfigureDatatypeManager();
+ DisableDatatype(error);
}
}
@@ -1777,9 +1792,7 @@
syncer::SyncError::DATATYPE_POLICY_ERROR,
"Delete directives not supported with encryption.",
syncer::HISTORY_DELETE_DIRECTIVES);
- FailedDataTypesHandler::TypeErrorMap error_map;
- error_map[error.model_type()] = error;
- failed_data_types_handler_.UpdateFailedDataTypes(error_map);
+ DisableDatatype(error);
}
ChangePreferredDataTypes(chosen_types);
AcknowledgeSyncedTypes();

Powered by Google App Engine
This is Rietveld 408576698