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

Unified Diff: components/sync_driver/ui_data_type_controller.cc

Issue 420633002: [Sync] Cleanup datatype configuration error handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile 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/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()),
« no previous file with comments | « components/sync_driver/ui_data_type_controller.h ('k') | components/sync_driver/ui_data_type_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698