OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SYNC_SESSIONS_MODEL_TYPE_REGISTRY_H_ | 5 #ifndef COMPONENTS_SYNC_SESSIONS_IMPL_MODEL_TYPE_REGISTRY_H_ |
6 #define SYNC_SESSIONS_MODEL_TYPE_REGISTRY_H_ | 6 #define COMPONENTS_SYNC_SESSIONS_IMPL_MODEL_TYPE_REGISTRY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "sync/base/sync_export.h" | 16 #include "components/sync/base/model_type.h" |
17 #include "sync/engine/nudge_handler.h" | 17 #include "components/sync/base/sync_export.h" |
18 #include "sync/internal_api/public/base/model_type.h" | 18 #include "components/sync/core/model_type_connector.h" |
19 #include "sync/internal_api/public/engine/model_safe_worker.h" | 19 #include "components/sync/core/non_blocking_sync_common.h" |
20 #include "sync/internal_api/public/model_type_connector.h" | 20 #include "components/sync/core/sync_encryption_handler.h" |
21 #include "sync/internal_api/public/non_blocking_sync_common.h" | 21 #include "components/sync/engine/model_safe_worker.h" |
22 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" | 22 #include "components/sync/engine_impl/nudge_handler.h" |
23 #include "sync/internal_api/public/sync_encryption_handler.h" | 23 #include "components/sync/sessions/type_debug_info_observer.h" |
24 | 24 |
25 namespace syncer_v2 { | 25 namespace syncer_v2 { |
26 struct DataTypeState; | 26 struct DataTypeState; |
27 class ModelTypeProcessor; | 27 class ModelTypeProcessor; |
28 class ModelTypeWorker; | 28 class ModelTypeWorker; |
29 } | 29 } |
30 | 30 |
31 namespace syncer { | 31 namespace syncer { |
32 | 32 |
33 namespace syncable { | 33 namespace syncable { |
34 class Directory; | 34 class Directory; |
35 } // namespace syncable | 35 } // namespace syncable |
36 | 36 |
37 class CommitContributor; | 37 class CommitContributor; |
38 class DirectoryCommitContributor; | 38 class DirectoryCommitContributor; |
39 class DirectoryUpdateHandler; | 39 class DirectoryUpdateHandler; |
40 class DirectoryTypeDebugInfoEmitter; | 40 class DirectoryTypeDebugInfoEmitter; |
41 class UpdateHandler; | 41 class UpdateHandler; |
42 | 42 |
43 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap; | 43 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap; |
44 typedef std::map<ModelType, CommitContributor*> CommitContributorMap; | 44 typedef std::map<ModelType, CommitContributor*> CommitContributorMap; |
45 typedef std::map<ModelType, DirectoryTypeDebugInfoEmitter*> | 45 typedef std::map<ModelType, DirectoryTypeDebugInfoEmitter*> |
46 DirectoryTypeDebugInfoEmitterMap; | 46 DirectoryTypeDebugInfoEmitterMap; |
47 | 47 |
48 // Keeps track of the sets of active update handlers and commit contributors. | 48 // Keeps track of the sets of active update handlers and commit contributors. |
49 class SYNC_EXPORT ModelTypeRegistry : public syncer_v2::ModelTypeConnector, | 49 class SYNC_EXPORT ModelTypeRegistry : public syncer_v2::ModelTypeConnector, |
50 public SyncEncryptionHandler::Observer { | 50 public SyncEncryptionHandler::Observer { |
51 public: | 51 public: |
52 // Constructs a ModelTypeRegistry that supports directory types. | 52 // Constructs a ModelTypeRegistry that supports directory types. |
53 ModelTypeRegistry(const std::vector<scoped_refptr<ModelSafeWorker> >& workers, | 53 ModelTypeRegistry(const std::vector<scoped_refptr<ModelSafeWorker>>& workers, |
54 syncable::Directory* directory, | 54 syncable::Directory* directory, |
55 NudgeHandler* nudge_handler); | 55 NudgeHandler* nudge_handler); |
56 ~ModelTypeRegistry() override; | 56 ~ModelTypeRegistry() override; |
57 | 57 |
58 // Sets the set of enabled types. | 58 // Sets the set of enabled types. |
59 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info); | 59 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info); |
60 | 60 |
61 // Enables an off-thread type for syncing. Connects the given proxy | 61 // Enables an off-thread type for syncing. Connects the given proxy |
62 // and its task_runner to the newly created worker. | 62 // and its task_runner to the newly created worker. |
63 // | 63 // |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // They do not own any of the objects they point to. | 128 // They do not own any of the objects they point to. |
129 UpdateHandlerMap update_handler_map_; | 129 UpdateHandlerMap update_handler_map_; |
130 CommitContributorMap commit_contributor_map_; | 130 CommitContributorMap commit_contributor_map_; |
131 | 131 |
132 // Map of DebugInfoEmitters for directory types. | 132 // Map of DebugInfoEmitters for directory types. |
133 // Non-blocking types handle debug info differently. | 133 // Non-blocking types handle debug info differently. |
134 // Does not own its contents. | 134 // Does not own its contents. |
135 DirectoryTypeDebugInfoEmitterMap directory_type_debug_info_emitter_map_; | 135 DirectoryTypeDebugInfoEmitterMap directory_type_debug_info_emitter_map_; |
136 | 136 |
137 // The known ModelSafeWorkers. | 137 // The known ModelSafeWorkers. |
138 std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker> > workers_map_; | 138 std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker>> workers_map_; |
139 | 139 |
140 // The directory. Not owned. | 140 // The directory. Not owned. |
141 syncable::Directory* directory_; | 141 syncable::Directory* directory_; |
142 | 142 |
143 // A copy of the directory's most recent cryptographer. | 143 // A copy of the directory's most recent cryptographer. |
144 std::unique_ptr<Cryptographer> cryptographer_; | 144 std::unique_ptr<Cryptographer> cryptographer_; |
145 | 145 |
146 // The set of encrypted types. | 146 // The set of encrypted types. |
147 ModelTypeSet encrypted_types_; | 147 ModelTypeSet encrypted_types_; |
148 | 148 |
(...skipping 11 matching lines...) Expand all Loading... |
160 // guaranteed to live as long as this sync backend. | 160 // guaranteed to live as long as this sync backend. |
161 base::ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; | 161 base::ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; |
162 | 162 |
163 base::WeakPtrFactory<ModelTypeRegistry> weak_ptr_factory_; | 163 base::WeakPtrFactory<ModelTypeRegistry> weak_ptr_factory_; |
164 | 164 |
165 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); | 165 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); |
166 }; | 166 }; |
167 | 167 |
168 } // namespace syncer | 168 } // namespace syncer |
169 | 169 |
170 #endif // SYNC_SESSIONS_MODEL_TYPE_REGISTRY_H_ | 170 #endif // COMPONENTS_SYNC_SESSIONS_IMPL_MODEL_TYPE_REGISTRY_H_ |
OLD | NEW |