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

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

Issue 10248006: [Sync] - add some debug info to track down issue 120709 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For submitting. Created 8 years, 8 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 | « chrome/browser/sync/glue/non_frontend_data_type_controller.h ('k') | no next file » | 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
diff --git a/chrome/browser/sync/glue/non_frontend_data_type_controller.cc b/chrome/browser/sync/glue/non_frontend_data_type_controller.cc
index 9e55614a58b4526f71bcba1aca5a68ed55aa8c85..9a3b53f50c845871954780670332544ac4fa64ea 100644
--- a/chrome/browser/sync/glue/non_frontend_data_type_controller.cc
+++ b/chrome/browser/sync/glue/non_frontend_data_type_controller.cc
@@ -33,7 +33,8 @@ NonFrontendDataTypeController::NonFrontendDataTypeController(
state_(NOT_RUNNING),
abort_association_(false),
abort_association_complete_(false, false),
- datatype_stopped_(false, false) {
+ datatype_stopped_(false, false),
+ start_association_called_(true, false) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(profile_sync_factory_);
DCHECK(profile_);
@@ -68,6 +69,27 @@ void NonFrontendDataTypeController::Start(const StartCallback& start_callback) {
}
}
+void NonFrontendDataTypeController::StopWhileAssociating() {
+ 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.
+ if (start_association_called_.IsSignaled()) {
+ LOG(INFO) << "Stopping after |StartAssocation| is called.";
+ abort_association_complete_.Wait();
+ } else {
+ LOG(INFO) << "Stopping before |StartAssocation| is called.";
+ abort_association_complete_.Wait();
+ }
+
+ StartDoneImpl(ABORTED, STOPPING, SyncError());
+}
+
void NonFrontendDataTypeController::Stop() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_NE(state_, NOT_RUNNING);
@@ -83,16 +105,15 @@ void NonFrontendDataTypeController::Stop() {
// 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();
+ if (type() == syncable::PASSWORDS) {
+ LOG(INFO) << " Type is Passwords";
+ StopWhileAssociating();
+ } else if (type() == syncable::TYPED_URLS) {
+ LOG(INFO) << " Type is TypedUrl";
+ StopWhileAssociating();
+ } else {
+ StopWhileAssociating();
}
- // Wait for the model association to abort.
- abort_association_complete_.Wait();
- StartDoneImpl(ABORTED, STOPPING, SyncError());
break;
case MODEL_STARTING:
state_ = STOPPING;
@@ -167,7 +188,8 @@ NonFrontendDataTypeController::NonFrontendDataTypeController()
state_(NOT_RUNNING),
abort_association_(false),
abort_association_complete_(false, false),
- datatype_stopped_(false, false) {
+ datatype_stopped_(false, false),
+ start_association_called_(true, false) {
}
NonFrontendDataTypeController::~NonFrontendDataTypeController() {
« no previous file with comments | « chrome/browser/sync/glue/non_frontend_data_type_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698