| Index: trunk/src/chrome/browser/sync/glue/frontend_data_type_controller.cc
|
| ===================================================================
|
| --- trunk/src/chrome/browser/sync/glue/frontend_data_type_controller.cc (revision 289111)
|
| +++ trunk/src/chrome/browser/sync/glue/frontend_data_type_controller.cc (working copy)
|
| @@ -30,7 +30,7 @@
|
| ProfileSyncComponentsFactory* profile_sync_factory,
|
| Profile* profile,
|
| ProfileSyncService* sync_service)
|
| - : DataTypeController(ui_thread, error_callback),
|
| + : DataTypeController(ui_thread, error_callback, DisableTypeCallback()),
|
| profile_sync_factory_(profile_sync_factory),
|
| profile_(profile),
|
| sync_service_(sync_service),
|
| @@ -85,6 +85,7 @@
|
| const StartCallback& start_callback) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| DCHECK(!start_callback.is_null());
|
| + DCHECK(start_callback_.is_null());
|
| DCHECK_EQ(state_, MODEL_LOADED);
|
|
|
| start_callback_ = start_callback;
|
| @@ -101,9 +102,6 @@
|
| void FrontendDataTypeController::Stop() {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| - if (state_ == NOT_RUNNING)
|
| - return;
|
| -
|
| State prev_state = state_;
|
| state_ = STOPPING;
|
|
|
| @@ -115,6 +113,7 @@
|
| // still in MODEL_STARTING.
|
| return;
|
| }
|
| + DCHECK(start_callback_.is_null());
|
|
|
| CleanUpState();
|
|
|
| @@ -146,21 +145,17 @@
|
| return state_;
|
| }
|
|
|
| -void FrontendDataTypeController::OnSingleDataTypeUnrecoverableError(
|
| - const syncer::SyncError& error) {
|
| - DCHECK_EQ(type(), error.model_type());
|
| - RecordUnrecoverableError(error.location(), error.message());
|
| - 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 FrontendDataTypeController::OnSingleDatatypeUnrecoverableError(
|
| + const tracked_objects::Location& from_here, const std::string& message) {
|
| + RecordUnrecoverableError(from_here, message);
|
| + syncer::SyncError error(
|
| + from_here, syncer::SyncError::DATATYPE_ERROR, message, type());
|
| + sync_service_->DisableDatatype(error);
|
| }
|
|
|
| FrontendDataTypeController::FrontendDataTypeController()
|
| - : DataTypeController(base::MessageLoopProxy::current(), base::Closure()),
|
| + : DataTypeController(base::MessageLoopProxy::current(), base::Closure(),
|
| + DisableTypeCallback()),
|
| profile_sync_factory_(NULL),
|
| profile_(NULL),
|
| sync_service_(NULL),
|
| @@ -284,7 +279,12 @@
|
| RecordStartFailure(start_result);
|
| }
|
|
|
| - start_callback_.Run(start_result, local_merge_result, syncer_merge_result);
|
| + // 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);
|
| }
|
|
|
| void FrontendDataTypeController::RecordAssociationTime(base::TimeDelta time) {
|
|
|