| Index: trunk/src/chrome/browser/sync/glue/non_frontend_data_type_controller.cc
|
| ===================================================================
|
| --- trunk/src/chrome/browser/sync/glue/non_frontend_data_type_controller.cc (revision 289354)
|
| +++ trunk/src/chrome/browser/sync/glue/non_frontend_data_type_controller.cc (working copy)
|
| @@ -157,16 +157,15 @@
|
| NonFrontendDataTypeController::AssociationResult::~AssociationResult() {}
|
|
|
| // TODO(tim): Legacy controllers are being left behind in componentization
|
| -// effort for now, hence passing null DisableTypeCallback and still having
|
| -// a dependency on ProfileSyncService. That dep can probably be removed
|
| -// without too much work.
|
| +// effort for now, hence still having a dependency on ProfileSyncService.
|
| +// That dep can probably be removed without too much work.
|
| NonFrontendDataTypeController::NonFrontendDataTypeController(
|
| scoped_refptr<base::MessageLoopProxy> ui_thread,
|
| const base::Closure& error_callback,
|
| ProfileSyncComponentsFactory* profile_sync_factory,
|
| Profile* profile,
|
| ProfileSyncService* sync_service)
|
| - : DataTypeController(ui_thread, error_callback, DisableTypeCallback()),
|
| + : DataTypeController(ui_thread, error_callback),
|
| state_(NOT_RUNNING),
|
| profile_sync_factory_(profile_sync_factory),
|
| profile_(profile),
|
| @@ -253,8 +252,10 @@
|
|
|
| void NonFrontendDataTypeController::Stop() {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - DCHECK_NE(state_, NOT_RUNNING);
|
|
|
| + if (state_ == NOT_RUNNING)
|
| + return;
|
| +
|
| // Deactivate the date type on the UI thread first to stop processing
|
| // sync server changes. This needs to happen before posting task to destroy
|
| // processor and associator on backend. Otherwise it could crash if syncer
|
| @@ -297,21 +298,19 @@
|
| return state_;
|
| }
|
|
|
| -void NonFrontendDataTypeController::OnSingleDatatypeUnrecoverableError(
|
| - const tracked_objects::Location& from_here,
|
| - const std::string& message) {
|
| +void NonFrontendDataTypeController::OnSingleDataTypeUnrecoverableError(
|
| + const syncer::SyncError& error) {
|
| DCHECK(IsOnBackendThread());
|
| - RecordUnrecoverableError(from_here, message);
|
| - BrowserThread::PostTask(BrowserThread::UI, from_here,
|
| + DCHECK_EQ(type(), error.model_type());
|
| + RecordUnrecoverableError(error.location(), error.message());
|
| + BrowserThread::PostTask(BrowserThread::UI, error.location(),
|
| base::Bind(&NonFrontendDataTypeController::DisableImpl,
|
| this,
|
| - from_here,
|
| - message));
|
| + error));
|
| }
|
|
|
| NonFrontendDataTypeController::NonFrontendDataTypeController()
|
| - : DataTypeController(base::MessageLoopProxy::current(), base::Closure(),
|
| - DisableTypeCallback()),
|
| + : DataTypeController(base::MessageLoopProxy::current(), base::Closure()),
|
| state_(NOT_RUNNING),
|
| profile_sync_factory_(NULL),
|
| profile_(NULL),
|
| @@ -371,22 +370,19 @@
|
| RecordStartFailure(start_result);
|
| }
|
|
|
| - DCHECK(!start_callback_.is_null());
|
| - // 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 NonFrontendDataTypeController::DisableImpl(
|
| - const tracked_objects::Location& from_here,
|
| - const std::string& message) {
|
| + const syncer::SyncError& error) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - syncer::SyncError error(
|
| - from_here, syncer::SyncError::DATATYPE_ERROR, message, type());
|
| - profile_sync_service_->DisableDatatype(error);
|
| + if (!start_callback_.is_null()) {
|
| + syncer::SyncMergeResult local_merge_result(type());
|
| + local_merge_result.set_error(error);
|
| + start_callback_.Run(RUNTIME_ERROR,
|
| + local_merge_result,
|
| + syncer::SyncMergeResult(type()));
|
| + }
|
| }
|
|
|
| void NonFrontendDataTypeController::RecordAssociationTime(
|
|
|