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

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

Issue 8312001: Revert 105668 - When StartFailed for a datatype the fix is to call StopAssociation which would ca... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/non_frontend_data_type_controller.cc
===================================================================
--- chrome/browser/sync/glue/non_frontend_data_type_controller.cc (revision 105673)
+++ chrome/browser/sync/glue/non_frontend_data_type_controller.cc (working copy)
@@ -124,7 +124,8 @@
void NonFrontendDataTypeController::StartFailed(StartResult result,
const SyncError& error) {
DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
- StopAssociation();
+ model_associator_.reset();
+ change_processor_.reset();
StartDone(result,
result == ASSOCIATION_FAILED ? DISABLED : NOT_RUNNING,
error);
@@ -179,39 +180,31 @@
// locking (see implementation in AutofillProfileDataTypeController).
void NonFrontendDataTypeController::Stop() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK_NE(state_, NOT_RUNNING);
// If Stop() is called while Start() is waiting for association to
// complete, we need to abort the association and wait for the DB
// thread to finish the StartImpl() task.
- switch (state_) {
- case ASSOCIATING:
- state_ = STOPPING;
- {
- base::AutoLock lock(abort_association_lock_);
- abort_association_ = true;
- if (model_associator_.get())
- model_associator_->AbortAssociation();
- }
- // Wait for the model association to abort.
- abort_association_complete_.Wait();
- StartDoneImpl(ABORTED, STOPPING, SyncError());
- break;
- case MODEL_STARTING:
- state_ = STOPPING;
- // If Stop() is called while Start() is waiting for the models to start,
- // abort the start. We don't need to continue on since it means we haven't
- // kicked off the association, and once we call StopModels, we never will.
- StartDoneImpl(ABORTED, NOT_RUNNING, SyncError());
- return;
- case DISABLED:
- state_ = NOT_RUNNING;
- StopModels();
- return;
- default:
- DCHECK_EQ(state_, RUNNING);
- state_ = STOPPING;
- StopModels();
- break;
+ if (state_ == ASSOCIATING) {
+ state_ = STOPPING;
+ {
+ base::AutoLock lock(abort_association_lock_);
+ abort_association_ = true;
+ if (model_associator_.get())
+ model_associator_->AbortAssociation();
+ }
+ // Wait for the model association to abort.
+ abort_association_complete_.Wait();
+ StartDoneImpl(ABORTED, STOPPING, SyncError());
+ } else if (state_ == MODEL_STARTING) {
+ state_ = STOPPING;
+ // If Stop() is called while Start() is waiting for the models to start,
+ // abort the start. We don't need to continue on since it means we haven't
+ // kicked off the association, and once we call StopModels, we never will.
+ StartDoneImpl(ABORTED, NOT_RUNNING, SyncError());
+ return;
+ } else {
+ state_ = STOPPING;
+
+ StopModels();
}
DCHECK(!start_callback_.get());
« no previous file with comments | « no previous file | chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698