OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
tim (not reviewing)
2014/01/16 18:28:22
nit, remove the (c)
rlarocque
2014/01/16 20:28:42
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ | |
6 #define SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/stl_util.h" | |
13 #include "sync/base/sync_export.h" | |
14 #include "sync/internal_api/public/base/model_type.h" | |
15 #include "sync/internal_api/public/engine/model_safe_worker.h" | |
16 | |
17 namespace syncer { | |
18 | |
19 namespace syncable { | |
20 class Directory; | |
21 } // namespace syncable | |
22 | |
23 class SyncDirectoryUpdateHandler; | |
24 class SyncDirectoryCommitContributor; | |
25 | |
26 typedef std::map<ModelType, SyncDirectoryUpdateHandler*> UpdateHandlerMap; | |
27 typedef std::map<ModelType, SyncDirectoryCommitContributor*> | |
28 CommitContributorMap; | |
29 | |
30 // Keeps track of the sets of active update handlers and commit contributors. | |
31 class SYNC_EXPORT_PRIVATE ModelTypeRegistry { | |
32 public: | |
33 ModelTypeRegistry( | |
34 const std::vector<ModelSafeWorker*>& workers, | |
35 syncable::Directory* directory); | |
36 ~ModelTypeRegistry(); | |
37 | |
38 // Sets the set of enabled types. | |
39 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info); | |
40 | |
41 // Simple getters. | |
42 UpdateHandlerMap* update_handler_map(); | |
43 CommitContributorMap* commit_contributor_map(); | |
44 | |
45 private: | |
46 // Classes to manage the types hooked up to receive and commit sync data. | |
47 UpdateHandlerMap update_handler_map_; | |
48 CommitContributorMap commit_contributor_map_; | |
49 | |
50 // Deleter for the |update_handler_map_|. | |
51 STLValueDeleter<UpdateHandlerMap> update_handler_deleter_; | |
52 | |
53 // Deleter for the |commit_contributor_map_|. | |
54 STLValueDeleter<CommitContributorMap> commit_contributor_deleter_; | |
55 | |
56 // The known ModelSafeWorkers. | |
57 std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker> > workers_map_; | |
58 | |
59 // The directory. Not owned. | |
60 syncable::Directory* directory_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); | |
63 }; | |
64 | |
65 } // namespace syncer | |
66 | |
67 #endif // SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ | |
68 | |
OLD | NEW |