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

Unified Diff: components/sync/engine_impl/model_type_registry.h

Issue 2641523004: [Sync] Make directory types registration explicit in ModelTypeRegistry (Closed)
Patch Set: Address comments Created 3 years, 11 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/engine_impl/model_type_registry.h
diff --git a/components/sync/engine_impl/model_type_registry.h b/components/sync/engine_impl/model_type_registry.h
index 5229f0d6c9fc80aeed79187d320def1b779afb59..3e25257e86a734439266b5a68c4b7a1536c1014d 100644
--- a/components/sync/engine_impl/model_type_registry.h
+++ b/components/sync/engine_impl/model_type_registry.h
@@ -38,21 +38,17 @@ typedef std::map<ModelType, CommitContributor*> CommitContributorMap;
class ModelTypeRegistry : public ModelTypeConnector,
public SyncEncryptionHandler::Observer {
public:
- // Constructs a ModelTypeRegistry that supports directory types.
ModelTypeRegistry(const std::vector<scoped_refptr<ModelSafeWorker>>& workers,
UserShare* user_share,
NudgeHandler* nudge_handler,
const UssMigrator& uss_migrator);
~ModelTypeRegistry() override;
- // Sets the set of enabled types.
- void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info);
-
// Enables an off-thread type for syncing. Connects the given proxy
// and its task_runner to the newly created worker.
//
// Expects that the proxy's ModelType is not currently enabled.
- void ConnectType(
+ void ConnectNonBlockingType(
ModelType type,
std::unique_ptr<ActivationContext> activation_context) override;
@@ -60,7 +56,15 @@ class ModelTypeRegistry : public ModelTypeConnector,
//
// Expects that the type is currently enabled.
// Deletes the worker associated with the type.
- void DisconnectType(ModelType type) override;
+ void DisconnectNonBlockingType(ModelType type) override;
+
+ // Creates update handler and commit contributor objects for directory type.
+ // Expects that the type is not yet registered.
+ void RegisterDirectoryType(ModelType type, ModelSafeGroup group) override;
+
+ // Deletes objects related to directory type. Expects that the type is
+ // registered.
+ void UnregisterDirectoryType(ModelType type) override;
// Implementation of SyncEncryptionHandler::Observer.
void OnPassphraseRequired(
@@ -118,9 +122,9 @@ class ModelTypeRegistry : public ModelTypeConnector,
}
// Sets of handlers and contributors.
- std::vector<std::unique_ptr<DirectoryCommitContributor>>
+ std::map<ModelType, std::unique_ptr<DirectoryCommitContributor>>
directory_commit_contributors_;
- std::vector<std::unique_ptr<DirectoryUpdateHandler>>
+ std::map<ModelType, std::unique_ptr<DirectoryUpdateHandler>>
directory_update_handlers_;
std::vector<std::unique_ptr<ModelTypeWorker>> model_type_workers_;
@@ -149,9 +153,6 @@ class ModelTypeRegistry : public ModelTypeConnector,
// The NudgeHandler. Not owned.
NudgeHandler* nudge_handler_;
- // The set of enabled directory types.
- ModelTypeSet enabled_directory_types_;
-
// Function to call to migrate data from the directory to USS.
UssMigrator uss_migrator_;
« no previous file with comments | « components/sync/engine_impl/model_type_connector_proxy.cc ('k') | components/sync/engine_impl/model_type_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698