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

Unified Diff: components/sync_bookmarks/bookmark_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/sync_bookmarks/bookmark_data_type_controller.cc
diff --git a/components/sync_bookmarks/bookmark_data_type_controller.cc b/components/sync_bookmarks/bookmark_data_type_controller.cc
index 54a80617e4167b4f42f085d6e34a9141f19a972f..9f407c75fea92c174a66d18c9d40534da417f7e2 100644
--- a/components/sync_bookmarks/bookmark_data_type_controller.cc
+++ b/components/sync_bookmarks/bookmark_data_type_controller.cc
@@ -15,21 +15,16 @@ using bookmarks::BookmarkModel;
namespace browser_sync {
BookmarkDataTypeController::BookmarkDataTypeController(
- const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
- const base::Closure& error_callback,
+ const base::Closure& dump_stack,
sync_driver::SyncClient* sync_client)
- : FrontendDataTypeController(ui_thread, error_callback, sync_client),
+ : FrontendDataTypeController(syncer::BOOKMARKS, dump_stack, sync_client),
history_service_observer_(this),
bookmark_model_observer_(this) {}
-syncer::ModelType BookmarkDataTypeController::type() const {
- return syncer::BOOKMARKS;
-}
-
-BookmarkDataTypeController::~BookmarkDataTypeController() {
-}
+BookmarkDataTypeController::~BookmarkDataTypeController() {}
bool BookmarkDataTypeController::StartModels() {
+ DCHECK(CalledOnValidThread());
if (!DependentsLoaded()) {
BookmarkModel* bookmark_model = sync_client_->GetBookmarkModel();
bookmark_model_observer_.Add(bookmark_model);
@@ -42,14 +37,16 @@ bool BookmarkDataTypeController::StartModels() {
}
void BookmarkDataTypeController::CleanUpState() {
+ DCHECK(CalledOnValidThread());
history_service_observer_.RemoveAll();
bookmark_model_observer_.RemoveAll();
}
void BookmarkDataTypeController::CreateSyncComponents() {
+ DCHECK(CalledOnValidThread());
sync_driver::SyncApiComponentFactory::SyncComponents sync_components =
sync_client_->GetSyncApiComponentFactory()->CreateBookmarkSyncComponents(
- sync_client_->GetSyncService(), this);
+ sync_client_->GetSyncService(), CreateErrorHandler());
set_model_associator(sync_components.model_associator);
set_change_processor(sync_components.change_processor);
}
@@ -59,6 +56,7 @@ void BookmarkDataTypeController::BookmarkModelChanged() {
void BookmarkDataTypeController::BookmarkModelLoaded(BookmarkModel* model,
bool ids_reassigned) {
+ DCHECK(CalledOnValidThread());
DCHECK(model->loaded());
bookmark_model_observer_.RemoveAll();
@@ -77,6 +75,7 @@ void BookmarkDataTypeController::BookmarkModelBeingDeleted(
// Check that both the bookmark model and the history service (for favicons)
// are loaded.
bool BookmarkDataTypeController::DependentsLoaded() {
+ DCHECK(CalledOnValidThread());
BookmarkModel* bookmark_model = sync_client_->GetBookmarkModel();
if (!bookmark_model || !bookmark_model->loaded())
return false;
@@ -91,6 +90,7 @@ bool BookmarkDataTypeController::DependentsLoaded() {
void BookmarkDataTypeController::OnHistoryServiceLoaded(
history::HistoryService* service) {
+ DCHECK(CalledOnValidThread());
DCHECK_EQ(state_, MODEL_STARTING);
history_service_observer_.RemoveAll();

Powered by Google App Engine
This is Rietveld 408576698