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

Unified Diff: components/sync/driver/glue/sync_backend_host_impl.h

Issue 2538023002: [Sync] Pass a TaskRunner into SBHI/SBHC, not a thread or message loop. (Closed)
Patch Set: Remove thread check in destructor. Created 4 years 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/glue/sync_backend_host_impl.h
diff --git a/components/sync/driver/glue/sync_backend_host_impl.h b/components/sync/driver/glue/sync_backend_host_impl.h
index 96849f54a8be5ca24db0778e42d65700309e779c..59fa562ebd32f9d19fdab0f47c770801d81c08a2 100644
--- a/components/sync/driver/glue/sync_backend_host_impl.h
+++ b/components/sync/driver/glue/sync_backend_host_impl.h
@@ -62,7 +62,6 @@ class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler {
SyncBackendHostImpl(
const std::string& name,
SyncClient* sync_client,
- const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
invalidation::InvalidationService* invalidator,
const base::WeakPtr<SyncPrefs>& sync_prefs,
const base::FilePath& sync_folder);
@@ -71,7 +70,7 @@ class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler {
// SyncBackendHost implementation.
void Initialize(
SyncFrontend* frontend,
- base::Thread* sync_thread,
+ scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner,
const WeakHandle<JsEventHandler>& event_handler,
const GURL& service_url,
const std::string& sync_user_agent,
@@ -288,17 +287,10 @@ class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler {
void ClearServerDataDoneOnFrontendLoop(
const SyncManager::ClearServerDataCallback& frontend_callback);
- // A reference to the TaskRUnner used to construct |this|, so we know how to
- // safely talk back to the SyncFrontend.
- scoped_refptr<base::SingleThreadTaskRunner> const frontend_task_runner_;
-
SyncClient* const sync_client_;
- // A pointer to the sync thread.
- base::Thread* sync_thread_;
-
- // The UI thread's task runner.
- const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
+ // The task runner where all the sync engine operations happen.
+ scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner_;
// Name used for debugging (set from profile_->GetDebugName()).
const std::string name_;
@@ -347,6 +339,9 @@ class SyncBackendHostImpl : public SyncBackendHost, public InvalidationHandler {
invalidation::InvalidationService* invalidator_;
bool invalidation_handler_registered_;
+ // Checks that we're on the same thread this was constructed on (UI thread).
+ base::ThreadChecker thread_checker_;
+
base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl);
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_core.cc ('k') | components/sync/driver/glue/sync_backend_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698