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

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

Issue 2489433002: [Sync] Move thread checking into the ModelSafeWorker interface. (Closed)
Patch Set: Improve/add comments. Created 4 years, 1 month 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_registrar.h
diff --git a/components/sync/driver/glue/sync_backend_registrar.h b/components/sync/driver/glue/sync_backend_registrar.h
index 6354658754867a0ae05d0126d990d901736fa9fd..cea0e11e31e15a4af926c21c6a3136cf0fcee12b 100644
--- a/components/sync/driver/glue/sync_backend_registrar.h
+++ b/components/sync/driver/glue/sync_backend_registrar.h
@@ -15,7 +15,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
-#include "base/threading/thread.h"
+#include "base/threading/thread_checker.h"
#include "components/sync/base/model_type.h"
#include "components/sync/engine/model_safe_worker.h"
#include "components/sync/engine/sync_manager.h"
@@ -32,12 +32,7 @@ struct UserShare;
class SyncBackendRegistrar : public SyncManager::ChangeDelegate {
public:
// |name| is used for debugging. Must be created on the UI thread.
- SyncBackendRegistrar(
- const std::string& name,
- SyncClient* sync_client,
- const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
- const scoped_refptr<base::SingleThreadTaskRunner>& db_thread,
- const scoped_refptr<base::SingleThreadTaskRunner>& file_thread);
+ SyncBackendRegistrar(const std::string& name, SyncClient* sync_client);
// A SyncBackendRegistrar is owned by a SyncBackendHostImpl. It is destroyed
// by SyncBackendHostImpl::Shutdown() which performs the following operations
@@ -136,10 +131,6 @@ class SyncBackendRegistrar : public SyncManager::ChangeDelegate {
// called with |lock_| held. May be called on any thread.
bool IsCurrentThreadSafeForModel(ModelType model_type) const;
- // Returns true if the current thread is the native thread for the
- // given group (or if it is undeterminable).
- bool IsOnThreadForGroup(ModelType type, ModelSafeGroup group) const;
-
// Returns model safe group that should be assigned to type when it is first
// configured (before activation). Returns GROUP_PASSIVE for directory types
// and GROUP_NON_BLOCKING for non-blocking types.
@@ -151,6 +142,9 @@ class SyncBackendRegistrar : public SyncManager::ChangeDelegate {
// A pointer to the sync client.
SyncClient* const sync_client_;
+ // Checker for the UI thread (where this object is constructed).
+ base::ThreadChecker ui_thread_checker_;
+
// Protects all variables below.
mutable base::Lock lock_;
@@ -166,11 +160,6 @@ class SyncBackendRegistrar : public SyncManager::ChangeDelegate {
// call to ConfigureDataTypes as well as SetInitialTypes.
ModelTypeSet last_configured_types_;
- // References to the thread task runners that sync depends on.
- const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
- const scoped_refptr<base::SingleThreadTaskRunner> db_thread_;
- const scoped_refptr<base::SingleThreadTaskRunner> file_thread_;
-
// Set of types with non-blocking implementation (as opposed to directory
// based).
ModelTypeSet non_blocking_types_;

Powered by Google App Engine
This is Rietveld 408576698