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

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

Issue 2501743005: [Sync] Remove SyncClient dep from SyncBackendRegistrar. (Closed)
Patch Set: Self-review. 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 cea0e11e31e15a4af926c21c6a3136cf0fcee12b..68f51f1d9b0e430a9e5bcfba1c1c28f5de43f443 100644
--- a/components/sync/driver/glue/sync_backend_registrar.h
+++ b/components/sync/driver/glue/sync_backend_registrar.h
@@ -12,6 +12,7 @@
#include <string>
#include <vector>
+#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
@@ -23,7 +24,6 @@
namespace syncer {
class ChangeProcessor;
-class SyncClient;
struct UserShare;
// A class that keep track of the workers, change processors, and
@@ -31,8 +31,12 @@ struct UserShare;
// events to the right processors.
class SyncBackendRegistrar : public SyncManager::ChangeDelegate {
public:
+ using ModelSafeWorkerFactory =
+ base::Callback<scoped_refptr<ModelSafeWorker>(ModelSafeGroup)>;
+
// |name| is used for debugging. Must be created on the UI thread.
- SyncBackendRegistrar(const std::string& name, SyncClient* sync_client);
+ SyncBackendRegistrar(const std::string& name,
+ ModelSafeWorkerFactory worker_factory);
// A SyncBackendRegistrar is owned by a SyncBackendHostImpl. It is destroyed
// by SyncBackendHostImpl::Shutdown() which performs the following operations
@@ -115,8 +119,10 @@ class SyncBackendRegistrar : public SyncManager::ChangeDelegate {
typedef std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker>> WorkerMap;
typedef std::map<ModelType, ChangeProcessor*> ProcessorMap;
- // Add a worker for |group| to the worker map if one can be created.
- void MaybeAddWorker(ModelSafeGroup group);
+ // Add a worker for |group| to the worker map if one is successfully created
+ // by |worker_factory|.
+ void MaybeAddWorker(ModelSafeWorkerFactory worker_factory,
+ ModelSafeGroup group);
// Returns the change processor for the given model, or null if none
// exists. Must be called from |group|'s native thread.
@@ -139,9 +145,6 @@ class SyncBackendRegistrar : public SyncManager::ChangeDelegate {
// Name used for debugging.
const std::string name_;
- // 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_;
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_impl.cc ('k') | components/sync/driver/glue/sync_backend_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698