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_ENGINE_MODEL_TYPE_REGISTRY_H_ | 5 #ifndef SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ |
6 #define SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ | 6 #define SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "sync/base/sync_export.h" | 14 #include "sync/base/sync_export.h" |
15 #include "sync/engine/nudge_handler.h" | 15 #include "sync/engine/nudge_handler.h" |
16 #include "sync/internal_api/public/base/model_type.h" | 16 #include "sync/internal_api/public/base/model_type.h" |
17 #include "sync/internal_api/public/engine/model_safe_worker.h" | 17 #include "sync/internal_api/public/engine/model_safe_worker.h" |
18 #include "sync/internal_api/public/non_blocking_sync_common.h" | 18 #include "sync/internal_api/public/non_blocking_sync_common.h" |
19 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" | 19 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" |
20 #include "sync/internal_api/public/sync_context.h" | 20 #include "sync/internal_api/public/sync_context.h" |
21 #include "sync/internal_api/public/sync_encryption_handler.h" | 21 #include "sync/internal_api/public/sync_encryption_handler.h" |
22 | 22 |
23 namespace syncer_v2 { | 23 namespace syncer_v2 { |
24 struct DataTypeState; | 24 struct DataTypeState; |
| 25 class ModelTypeSyncWorkerImpl; |
| 26 class ModelTypeSyncProxyImpl; |
25 } | 27 } |
26 | 28 |
27 namespace syncer { | 29 namespace syncer { |
28 | 30 |
29 namespace syncable { | 31 namespace syncable { |
30 class Directory; | 32 class Directory; |
31 } // namespace syncable | 33 } // namespace syncable |
32 | 34 |
33 class CommitContributor; | 35 class CommitContributor; |
34 class DirectoryCommitContributor; | 36 class DirectoryCommitContributor; |
35 class DirectoryUpdateHandler; | 37 class DirectoryUpdateHandler; |
36 class DirectoryTypeDebugInfoEmitter; | 38 class DirectoryTypeDebugInfoEmitter; |
37 class ModelTypeSyncWorkerImpl; | |
38 class ModelTypeSyncProxyImpl; | |
39 class UpdateHandler; | 39 class UpdateHandler; |
40 | 40 |
41 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap; | 41 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap; |
42 typedef std::map<ModelType, CommitContributor*> CommitContributorMap; | 42 typedef std::map<ModelType, CommitContributor*> CommitContributorMap; |
43 typedef std::map<ModelType, DirectoryTypeDebugInfoEmitter*> | 43 typedef std::map<ModelType, DirectoryTypeDebugInfoEmitter*> |
44 DirectoryTypeDebugInfoEmitterMap; | 44 DirectoryTypeDebugInfoEmitterMap; |
45 | 45 |
46 // Keeps track of the sets of active update handlers and commit contributors. | 46 // Keeps track of the sets of active update handlers and commit contributors. |
47 class SYNC_EXPORT_PRIVATE ModelTypeRegistry | 47 class SYNC_EXPORT_PRIVATE ModelTypeRegistry |
48 : public syncer_v2::SyncContext, | 48 : public syncer_v2::SyncContext, |
(...skipping 10 matching lines...) Expand all Loading... |
59 | 59 |
60 // Enables an off-thread type for syncing. Connects the given proxy | 60 // Enables an off-thread type for syncing. Connects the given proxy |
61 // and its task_runner to the newly created worker. | 61 // and its task_runner to the newly created worker. |
62 // | 62 // |
63 // Expects that the proxy's ModelType is not currently enabled. | 63 // Expects that the proxy's ModelType is not currently enabled. |
64 void ConnectSyncTypeToWorker( | 64 void ConnectSyncTypeToWorker( |
65 syncer::ModelType type, | 65 syncer::ModelType type, |
66 const syncer_v2::DataTypeState& data_type_state, | 66 const syncer_v2::DataTypeState& data_type_state, |
67 const syncer_v2::UpdateResponseDataList& saved_pending_updates, | 67 const syncer_v2::UpdateResponseDataList& saved_pending_updates, |
68 const scoped_refptr<base::SequencedTaskRunner>& type_task_runner, | 68 const scoped_refptr<base::SequencedTaskRunner>& type_task_runner, |
69 const base::WeakPtr<ModelTypeSyncProxyImpl>& proxy) override; | 69 const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& proxy) override; |
70 | 70 |
71 // Disables the syncing of an off-thread type. | 71 // Disables the syncing of an off-thread type. |
72 // | 72 // |
73 // Expects that the type is currently enabled. | 73 // Expects that the type is currently enabled. |
74 // Deletes the worker associated with the type. | 74 // Deletes the worker associated with the type. |
75 void DisconnectSyncWorker(syncer::ModelType type) override; | 75 void DisconnectSyncWorker(syncer::ModelType type) override; |
76 | 76 |
77 // Implementation of SyncEncryptionHandler::Observer. | 77 // Implementation of SyncEncryptionHandler::Observer. |
78 void OnPassphraseRequired( | 78 void OnPassphraseRequired( |
79 PassphraseRequiredReason reason, | 79 PassphraseRequiredReason reason, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 ModelTypeSet GetEnabledNonBlockingTypes() const; | 114 ModelTypeSet GetEnabledNonBlockingTypes() const; |
115 ModelTypeSet GetEnabledDirectoryTypes() const; | 115 ModelTypeSet GetEnabledDirectoryTypes() const; |
116 | 116 |
117 // Sets of handlers and contributors. | 117 // Sets of handlers and contributors. |
118 ScopedVector<DirectoryCommitContributor> directory_commit_contributors_; | 118 ScopedVector<DirectoryCommitContributor> directory_commit_contributors_; |
119 ScopedVector<DirectoryUpdateHandler> directory_update_handlers_; | 119 ScopedVector<DirectoryUpdateHandler> directory_update_handlers_; |
120 ScopedVector<DirectoryTypeDebugInfoEmitter> | 120 ScopedVector<DirectoryTypeDebugInfoEmitter> |
121 directory_type_debug_info_emitters_; | 121 directory_type_debug_info_emitters_; |
122 | 122 |
123 ScopedVector<ModelTypeSyncWorkerImpl> model_type_sync_workers_; | 123 ScopedVector<syncer_v2::ModelTypeSyncWorkerImpl> model_type_sync_workers_; |
124 | 124 |
125 // Maps of UpdateHandlers and CommitContributors. | 125 // Maps of UpdateHandlers and CommitContributors. |
126 // They do not own any of the objects they point to. | 126 // They do not own any of the objects they point to. |
127 UpdateHandlerMap update_handler_map_; | 127 UpdateHandlerMap update_handler_map_; |
128 CommitContributorMap commit_contributor_map_; | 128 CommitContributorMap commit_contributor_map_; |
129 | 129 |
130 // Map of DebugInfoEmitters for directory types. | 130 // Map of DebugInfoEmitters for directory types. |
131 // Non-blocking types handle debug info differently. | 131 // Non-blocking types handle debug info differently. |
132 // Does not own its contents. | 132 // Does not own its contents. |
133 DirectoryTypeDebugInfoEmitterMap directory_type_debug_info_emitter_map_; | 133 DirectoryTypeDebugInfoEmitterMap directory_type_debug_info_emitter_map_; |
(...skipping 25 matching lines...) Expand all Loading... |
159 base::ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; | 159 base::ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; |
160 | 160 |
161 base::WeakPtrFactory<ModelTypeRegistry> weak_ptr_factory_; | 161 base::WeakPtrFactory<ModelTypeRegistry> weak_ptr_factory_; |
162 | 162 |
163 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); | 163 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); |
164 }; | 164 }; |
165 | 165 |
166 } // namespace syncer | 166 } // namespace syncer |
167 | 167 |
168 #endif // SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ | 168 #endif // SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ |
OLD | NEW |