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

Unified Diff: components/sync_driver/ui_data_type_controller.cc

Issue 1024223002: [Sync] Split model association into multiple UI tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 5 years, 9 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: components/sync_driver/ui_data_type_controller.cc
diff --git a/components/sync_driver/ui_data_type_controller.cc b/components/sync_driver/ui_data_type_controller.cc
index 24ded5b5ec9f3ddc794bcdef770bb6a929e0153c..0f42e9e4a992bb297a42d02f5e9bc323d9cab1cf 100644
--- a/components/sync_driver/ui_data_type_controller.cc
+++ b/components/sync_driver/ui_data_type_controller.cc
@@ -96,10 +96,8 @@ void UIDataTypeController::StartAssociating(
start_callback_ = start_callback;
state_ = ASSOCIATING;
- Associate();
- // It's possible StartDone(..) resulted in a Stop() call, or that association
- // failed, so we just verify that the state has moved foward.
- DCHECK_NE(state_, ASSOCIATING);
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(&UIDataTypeController::Associate, this));
}
bool UIDataTypeController::StartModels() {
@@ -110,7 +108,12 @@ bool UIDataTypeController::StartModels() {
}
void UIDataTypeController::Associate() {
- DCHECK_EQ(state_, ASSOCIATING);
+ if (state_ != ASSOCIATING) {
+ // Stop() must have been called while Associate() task have been waiting.
+ DCHECK_EQ(state_, NOT_RUNNING);
+ return;
+ }
+
syncer::SyncMergeResult local_merge_result(type());
syncer::SyncMergeResult syncer_merge_result(type());
base::WeakPtrFactory<syncer::SyncMergeResult> weak_ptr_factory(

Powered by Google App Engine
This is Rietveld 408576698