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

Unified Diff: components/sync/driver/model_type_controller.cc

Issue 2668323002: [Sync] Only get bridge on model thread for ModelTypeController. (Closed)
Patch Set: Created 3 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/driver/model_type_controller.cc
diff --git a/components/sync/driver/model_type_controller.cc b/components/sync/driver/model_type_controller.cc
index 4c5d56f05c9ada4e021dc5d459b55b025b2e2c35..6efaeef218d34e457b3cd5be97249cd5d9cc5437 100644
--- a/components/sync/driver/model_type_controller.cc
+++ b/components/sync/driver/model_type_controller.cc
@@ -59,6 +59,14 @@ void CallGetStatusCountersHelper(
}
}
+void CallDisableSyncHelper(SyncClient* sync_client, ModelType type) {
+ base::WeakPtr<ModelTypeSyncBridge> bridge =
+ sync_client->GetSyncBridgeForModelType(type);
+ if (bridge) {
+ bridge->DisableSync();
+ }
+}
+
void ReportError(ModelType model_type,
scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
const ModelErrorHandler& error_handler,
@@ -221,8 +229,7 @@ void ModelTypeController::Stop() {
if ((state() == MODEL_LOADED || state() == RUNNING) &&
(!sync_prefs_.IsFirstSetupComplete() || !preferred_types.Has(type()))) {
model_thread_->PostTask(
- FROM_HERE, base::Bind(&ModelTypeSyncBridge::DisableSync,
- sync_client_->GetSyncBridgeForModelType(type())));
+ FROM_HERE, base::Bind(&CallDisableSyncHelper, sync_client_, type()));
}
state_ = NOT_RUNNING;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698