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

Unified Diff: sync/sessions/sync_session_context.h

Issue 93433006: sync: Introduce ModelTypeRegistry and helpers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing files Created 6 years, 12 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: sync/sessions/sync_session_context.h
diff --git a/sync/sessions/sync_session_context.h b/sync/sessions/sync_session_context.h
index 5995ab151dbcbba209872310ce532fcfa3030da7..cbd807b7a775790823f1fb43bfc8059179f813f5 100644
--- a/sync/sessions/sync_session_context.h
+++ b/sync/sessions/sync_session_context.h
@@ -15,25 +15,19 @@
#ifndef SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_
#define SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_
-#include <map>
#include <string>
-#include <vector>
-#include "base/stl_util.h"
#include "sync/base/sync_export.h"
-#include "sync/engine/sync_directory_commit_contributor.h"
-#include "sync/engine/sync_directory_update_handler.h"
+#include "sync/engine/model_type_registry.h"
#include "sync/engine/sync_engine_event.h"
-#include "sync/engine/syncer_types.h"
#include "sync/engine/traffic_recorder.h"
-#include "sync/internal_api/public/engine/model_safe_worker.h"
-#include "sync/protocol/sync.pb.h"
#include "sync/sessions/debug_info_getter.h"
namespace syncer {
class ExtensionsActivity;
class ServerConnectionManager;
+class ModelTypeRegistry;
Nicolas Zea 2014/01/04 02:09:34 nit: abc order
rlarocque 2014/01/06 20:03:33 Done.
namespace syncable {
class Directory;
@@ -49,11 +43,11 @@ class SYNC_EXPORT_PRIVATE SyncSessionContext {
public:
SyncSessionContext(ServerConnectionManager* connection_manager,
syncable::Directory* directory,
- const std::vector<ModelSafeWorker*>& workers,
ExtensionsActivity* extensions_activity,
const std::vector<SyncEngineEventListener*>& listeners,
DebugInfoGetter* debug_info_getter,
TrafficRecorder* traffic_recorder,
+ ModelTypeRegistry* model_type_registry,
bool keystore_encryption_enabled,
bool client_enabled_pre_commit_update_avoidance,
const std::string& invalidator_client_id);
@@ -71,15 +65,7 @@ class SYNC_EXPORT_PRIVATE SyncSessionContext {
return enabled_types_;
}
- void set_routing_info(const ModelSafeRoutingInfo& routing_info);
-
- UpdateHandlerMap* update_handler_map() {
- return &update_handler_map_;
- }
-
- CommitContributorMap* commit_contributor_map() {
- return &commit_contributor_map_;
- }
+ void SetRoutingInfo(const ModelSafeRoutingInfo& routing_info);
ExtensionsActivity* extensions_activity() {
return extensions_activity_.get();
@@ -141,6 +127,14 @@ class SYNC_EXPORT_PRIVATE SyncSessionContext {
server_enabled_pre_commit_update_avoidance_ = value;
}
+ UpdaterList* updater_list() {
+ return model_type_registry_->updater_list();
+ }
+
+ CommitterList* committer_list() {
+ return model_type_registry_->committer_list();
+ }
+
private:
// Rather than force clients to set and null-out various context members, we
// extend our encapsulation boundary to scoped helpers that take care of this
@@ -156,25 +150,6 @@ class SYNC_EXPORT_PRIVATE SyncSessionContext {
// set_routing_info().
ModelTypeSet enabled_types_;
- // A map of 'update handlers', one for each enabled type.
- // This must be kept in sync with the routing info. Our temporary solution to
- // that problem is to initialize this map in set_routing_info().
- UpdateHandlerMap update_handler_map_;
-
- // Deleter for the |update_handler_map_|.
- STLValueDeleter<UpdateHandlerMap> update_handler_deleter_;
-
- // A map of 'commit contributors', one for each enabled type.
- // This must be kept in sync with the routing info. Our temporary solution to
- // that problem is to initialize this map in set_routing_info().
- CommitContributorMap commit_contributor_map_;
-
- // Deleter for the |commit_contributor_map_|.
- STLValueDeleter<CommitContributorMap> commit_contributor_deleter_;
-
- // The set of ModelSafeWorkers. Used to execute tasks of various threads.
- std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker> > workers_;
-
// We use this to stuff extensions activity into CommitMessages so the server
// can correlate commit traffic with extension-related bookmark mutations.
scoped_refptr<ExtensionsActivity> extensions_activity_;
@@ -195,6 +170,8 @@ class SYNC_EXPORT_PRIVATE SyncSessionContext {
TrafficRecorder* traffic_recorder_;
+ ModelTypeRegistry* model_type_registry_;
+
// Satus information to be sent up to the server.
sync_pb::ClientStatus client_status_;

Powered by Google App Engine
This is Rietveld 408576698