| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class Directory; | 21 class Directory; |
| 22 } // namespace syncable | 22 } // namespace syncable |
| 23 | 23 |
| 24 class CommitContributor; | 24 class CommitContributor; |
| 25 class DirectoryCommitContributor; | 25 class DirectoryCommitContributor; |
| 26 class DirectoryUpdateHandler; | 26 class DirectoryUpdateHandler; |
| 27 class DirectoryTypeDebugInfoEmitter; | 27 class DirectoryTypeDebugInfoEmitter; |
| 28 class NonBlockingTypeProcessorCore; | 28 class NonBlockingTypeProcessorCore; |
| 29 class NonBlockingTypeProcessor; | 29 class NonBlockingTypeProcessor; |
| 30 class UpdateHandler; | 30 class UpdateHandler; |
| 31 struct DataTypeState; |
| 31 | 32 |
| 32 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap; | 33 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap; |
| 33 typedef std::map<ModelType, CommitContributor*> CommitContributorMap; | 34 typedef std::map<ModelType, CommitContributor*> CommitContributorMap; |
| 34 typedef std::map<ModelType, DirectoryTypeDebugInfoEmitter*> | 35 typedef std::map<ModelType, DirectoryTypeDebugInfoEmitter*> |
| 35 DirectoryTypeDebugInfoEmitterMap; | 36 DirectoryTypeDebugInfoEmitterMap; |
| 36 | 37 |
| 37 // Keeps track of the sets of active update handlers and commit contributors. | 38 // Keeps track of the sets of active update handlers and commit contributors. |
| 38 class SYNC_EXPORT_PRIVATE ModelTypeRegistry { | 39 class SYNC_EXPORT_PRIVATE ModelTypeRegistry { |
| 39 public: | 40 public: |
| 40 // This alternative constructor does not support any directory types. | 41 // This alternative constructor does not support any directory types. |
| 41 // It is used only in tests. | 42 // It is used only in tests. |
| 42 ModelTypeRegistry(); | 43 ModelTypeRegistry(); |
| 43 | 44 |
| 44 // Constructs a ModelTypeRegistry that supports directory types. | 45 // Constructs a ModelTypeRegistry that supports directory types. |
| 45 ModelTypeRegistry( | 46 ModelTypeRegistry( |
| 46 const std::vector<scoped_refptr<ModelSafeWorker> >& workers, | 47 const std::vector<scoped_refptr<ModelSafeWorker> >& workers, |
| 47 syncable::Directory* directory); | 48 syncable::Directory* directory); |
| 48 ~ModelTypeRegistry(); | 49 ~ModelTypeRegistry(); |
| 49 | 50 |
| 50 // Sets the set of enabled types. | 51 // Sets the set of enabled types. |
| 51 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info); | 52 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info); |
| 52 | 53 |
| 53 // Enables an off-thread type for syncing. Connects the given processor | 54 // Enables an off-thread type for syncing. Connects the given processor |
| 54 // and its task_runner to the newly created processor core. | 55 // and its task_runner to the newly created processor core. |
| 55 // | 56 // |
| 56 // Expects that the processor's ModelType is not currently enabled. | 57 // Expects that the processor's ModelType is not currently enabled. |
| 57 void InitializeNonBlockingType( | 58 void InitializeNonBlockingType( |
| 58 syncer::ModelType type, | 59 syncer::ModelType type, |
| 60 const DataTypeState& data_type_state, |
| 59 scoped_refptr<base::SequencedTaskRunner> type_task_runner, | 61 scoped_refptr<base::SequencedTaskRunner> type_task_runner, |
| 60 base::WeakPtr<NonBlockingTypeProcessor> processor); | 62 base::WeakPtr<NonBlockingTypeProcessor> processor); |
| 61 | 63 |
| 62 // Disables the syncing of an off-thread type. | 64 // Disables the syncing of an off-thread type. |
| 63 // | 65 // |
| 64 // Expects that the type is currently enabled. | 66 // Expects that the type is currently enabled. |
| 65 // Deletes the processor core associated with the type. | 67 // Deletes the processor core associated with the type. |
| 66 void RemoveNonBlockingType(syncer::ModelType type); | 68 void RemoveNonBlockingType(syncer::ModelType type); |
| 67 | 69 |
| 68 // Gets the set of enabled types. | 70 // Gets the set of enabled types. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // guaranteed to live as long as this sync backend. | 122 // guaranteed to live as long as this sync backend. |
| 121 ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; | 123 ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; |
| 122 | 124 |
| 123 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); | 125 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); |
| 124 }; | 126 }; |
| 125 | 127 |
| 126 } // namespace syncer | 128 } // namespace syncer |
| 127 | 129 |
| 128 #endif // SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ | 130 #endif // SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ |
| 129 | 131 |
| OLD | NEW |