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

Unified Diff: components/search_engines/search_engine_data_type_controller.cc

Issue 2289143003: [Sync] Convert DTCs to be not RefCounted and NonThreadSafe. (Closed)
Patch Set: Rebase. Created 4 years, 3 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/search_engines/search_engine_data_type_controller.cc
diff --git a/components/search_engines/search_engine_data_type_controller.cc b/components/search_engines/search_engine_data_type_controller.cc
index 6492095eb028a29b21d89e37dc0fe3664ca4fe6b..e405667c5f5026e20d343f6abf6ab6be82fb668f 100644
--- a/components/search_engines/search_engine_data_type_controller.cc
+++ b/components/search_engines/search_engine_data_type_controller.cc
@@ -7,15 +7,10 @@
namespace browser_sync {
SearchEngineDataTypeController::SearchEngineDataTypeController(
- const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
- const base::Closure& error_callback,
+ const base::Closure& dump_stack,
sync_driver::SyncClient* sync_client,
TemplateURLService* template_url_service)
- : UIDataTypeController(ui_thread,
- error_callback,
- syncer::SEARCH_ENGINES,
- sync_client),
- ui_thread_(ui_thread),
+ : UIDataTypeController(syncer::SEARCH_ENGINES, dump_stack, sync_client),
template_url_service_(template_url_service) {}
TemplateURLService::Subscription*
@@ -27,6 +22,7 @@ SearchEngineDataTypeController::~SearchEngineDataTypeController() {}
// We want to start the TemplateURLService before we begin associating.
bool SearchEngineDataTypeController::StartModels() {
+ DCHECK(CalledOnValidThread());
// If the TemplateURLService is loaded, continue with association. We force
// a load here to prevent the rest of Sync from waiting on
// TemplateURLService's lazy load.
@@ -37,19 +33,20 @@ bool SearchEngineDataTypeController::StartModels() {
}
// Register a callback and continue when the TemplateURLService is loaded.
- template_url_subscription_ =
- template_url_service_->RegisterOnLoadedCallback(base::Bind(
- &SearchEngineDataTypeController::OnTemplateURLServiceLoaded, this));
+ template_url_subscription_ = template_url_service_->RegisterOnLoadedCallback(
+ base::Bind(&SearchEngineDataTypeController::OnTemplateURLServiceLoaded,
+ base::AsWeakPtr(this)));
return false; // Don't continue Start.
}
void SearchEngineDataTypeController::StopModels() {
+ DCHECK(CalledOnValidThread());
template_url_subscription_.reset();
}
void SearchEngineDataTypeController::OnTemplateURLServiceLoaded() {
- DCHECK(ui_thread_->BelongsToCurrentThread());
+ DCHECK(CalledOnValidThread());
DCHECK_EQ(MODEL_STARTING, state_);
template_url_subscription_.reset();
OnModelLoaded();

Powered by Google App Engine
This is Rietveld 408576698