Index: components/sync_driver/ui_data_type_controller.cc |
diff --git a/components/sync_driver/ui_data_type_controller.cc b/components/sync_driver/ui_data_type_controller.cc |
index edfe452acad5a654bc825e723eec7e22c81189bf..3b7945c33012c5124cbb725a9875d75416c99c27 100644 |
--- a/components/sync_driver/ui_data_type_controller.cc |
+++ b/components/sync_driver/ui_data_type_controller.cc |
@@ -145,6 +145,11 @@ void UIDataTypeController::Associate() { |
} |
if (!shared_change_processor_->CryptoReadyIfNecessary()) { |
+ syncer::SyncError error(FROM_HERE, |
+ syncer::SyncError::CRYPTO_ERROR, |
+ "", |
+ type()); |
+ local_merge_result.set_error(error); |
StartDone(NEEDS_CRYPTO, |
local_merge_result, |
syncer_merge_result); |
@@ -237,7 +242,7 @@ void UIDataTypeController::AbortModelLoad() { |
} |
void UIDataTypeController::StartDone( |
- StartResult start_result, |
+ ConfigureResult start_result, |
const syncer::SyncMergeResult& local_merge_result, |
const syncer::SyncMergeResult& syncer_merge_result) { |
DCHECK(ui_thread_->BelongsToCurrentThread()); |
@@ -257,12 +262,7 @@ void UIDataTypeController::StartDone( |
} |
} |
- // We have to release the callback before we call it, since it's possible |
- // invoking the callback will trigger a call to Stop(), which will get |
- // confused by the non-NULL start_callback_. |
- StartCallback callback = start_callback_; |
- start_callback_.Reset(); |
- callback.Run(start_result, local_merge_result, syncer_merge_result); |
+ start_callback_.Run(start_result, local_merge_result, syncer_merge_result); |
} |
void UIDataTypeController::Stop() { |
@@ -285,7 +285,6 @@ void UIDataTypeController::Stop() { |
// still in MODEL_STARTING. |
return; |
} |
- DCHECK(start_callback_.is_null()); |
StopModels(); |
@@ -327,8 +326,15 @@ void UIDataTypeController::OnSingleDatatypeUnrecoverableError( |
// TODO(tim): We double-upload some errors. See bug 383480. |
if (!error_callback_.is_null()) |
error_callback_.Run(); |
- if (!disable_callback().is_null()) |
- disable_callback().Run(from_here, message); |
+ if (!start_callback_.is_null()) { |
+ syncer::SyncError error( |
+ from_here, syncer::SyncError::DATATYPE_ERROR, message, type()); |
+ syncer::SyncMergeResult local_merge_result(type()); |
+ local_merge_result.set_error(error); |
+ start_callback_.Run(RUNTIME_ERROR, |
+ local_merge_result, |
+ syncer::SyncMergeResult(type())); |
+ } |
} |
void UIDataTypeController::RecordAssociationTime(base::TimeDelta time) { |
@@ -339,7 +345,7 @@ void UIDataTypeController::RecordAssociationTime(base::TimeDelta time) { |
#undef PER_DATA_TYPE_MACRO |
} |
-void UIDataTypeController::RecordStartFailure(StartResult result) { |
+void UIDataTypeController::RecordStartFailure(ConfigureResult result) { |
DCHECK(ui_thread_->BelongsToCurrentThread()); |
UMA_HISTOGRAM_ENUMERATION("Sync.DataTypeStartFailures", |
ModelTypeToHistogramInt(type()), |