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

Unified Diff: chrome/browser/sync/glue/frontend_data_type_controller.cc

Issue 7453014: [Sync] Refactor sync datatype error handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 5 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: chrome/browser/sync/glue/frontend_data_type_controller.cc
diff --git a/chrome/browser/sync/glue/frontend_data_type_controller.cc b/chrome/browser/sync/glue/frontend_data_type_controller.cc
index 9a22cb84fe966e389f81b91bc6f72577e0fd828e..6d997873011f481afcc0ca5f600e42864086f2aa 100644
--- a/chrome/browser/sync/glue/frontend_data_type_controller.cc
+++ b/chrome/browser/sync/glue/frontend_data_type_controller.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/api/sync_error.h"
#include "chrome/browser/sync/glue/change_processor.h"
#include "chrome/browser/sync/glue/model_associator.h"
#include "chrome/browser/sync/profile_sync_factory.h"
@@ -92,10 +93,11 @@ bool FrontendDataTypeController::Associate() {
}
base::TimeTicks start_time = base::TimeTicks::Now();
- bool merge_success = model_associator()->AssociateModels();
+ SyncError error;
+ bool merge_success = model_associator()->AssociateModels(&error);
RecordAssociationTime(base::TimeTicks::Now() - start_time);
if (!merge_success) {
- StartFailed(ASSOCIATION_FAILED, FROM_HERE);
+ StartFailed(ASSOCIATION_FAILED, error.location());
return false;
}
@@ -105,7 +107,8 @@ bool FrontendDataTypeController::Associate() {
return true;
}
-void FrontendDataTypeController::StartFailed(StartResult result,
+void FrontendDataTypeController::StartFailed(
+ StartResult result,
const tracked_objects::Location& location) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
CleanUpState();
@@ -118,10 +121,12 @@ void FrontendDataTypeController::StartFailed(StartResult result,
// invoking the callback will trigger a call to STOP(), which will get
// confused by the non-NULL start_callback_.
scoped_ptr<StartCallback> callback(start_callback_.release());
+ // TODO(zea): Send the full SyncError on failure and handle it higher up.
callback->Run(result, location);
}
-void FrontendDataTypeController::FinishStart(StartResult result,
+void FrontendDataTypeController::FinishStart(
+ StartResult result,
const tracked_objects::Location& location) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -149,8 +154,10 @@ void FrontendDataTypeController::Stop() {
if (change_processor_.get())
sync_service_->DeactivateDataType(this, change_processor_.get());
- if (model_associator())
- model_associator()->DisassociateModels();
+ if (model_associator()) {
+ SyncError error;
+ model_associator()->DisassociateModels(&error);
+ }
set_model_associator(NULL);
change_processor_.reset();

Powered by Google App Engine
This is Rietveld 408576698