OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
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_COMMITTER_LIST_H_ | |
6 #define SYNC_ENGINE_COMMITTER_LIST_H_ | |
7 | |
8 #include <map> | |
9 #include <vector> | |
10 | |
11 #include "base/stl_util.h" | |
12 #include "sync/base/sync_export.h" | |
13 #include "sync/internal_api/public/base/model_type.h" | |
14 #include "sync/internal_api/public/engine/model_safe_worker.h" | |
15 | |
16 namespace syncer { | |
17 | |
18 namespace syncable { | |
19 class Directory; | |
20 } // namespace syncable | |
21 | |
22 class SyncDirectoryCommitContributor; | |
23 class SyncDirectoryCommitContribution; | |
24 | |
25 typedef std::map<ModelType, SyncDirectoryCommitContribution*> ContributionMap; | |
Nicolas Zea
2013/12/18 22:36:10
Do no other places declare this typedef? Does it n
rlarocque
2014/01/03 01:46:41
It could be moved into CommitterList, but I think
| |
26 | |
27 // This class manages the set of per-type committer objects. | |
28 // | |
29 // It owns these types and hides the details of iterating over all of them. | |
30 // Many methods allow the caller to specify a subset of types on which the | |
31 // operation is to be applied. It is a logic error if the supplied set of types | |
32 // contains a type which was not previously registered. | |
33 class SYNC_EXPORT_PRIVATE CommitterList { | |
34 public: | |
35 CommitterList(); | |
36 ~CommitterList(); | |
37 | |
38 // Builds or rebuilds the set of syncable::Directory sync type objects. | |
39 void SetEnabledSyncDirectoryTypes( | |
Nicolas Zea
2013/12/18 22:36:10
Why not just SetEnabledTypes? In the bismarck worl
rlarocque
2014/01/03 01:46:41
I'm thinking it won't have access to that informat
| |
40 const std::vector<scoped_refptr<ModelSafeWorker> > workers, | |
Nicolas Zea
2013/12/18 22:36:10
const ref
rlarocque
2014/01/03 01:46:41
Removed in the most recent patch.
| |
41 const ModelSafeRoutingInfo& routing_info, | |
42 syncable::Directory* dir); | |
43 | |
44 // Gathers a set of contributions to be used to populate a commit message. | |
45 void GatherCommitContributions( | |
46 ModelTypeSet commit_types, | |
47 size_t max_entries, | |
48 ContributionMap* contributions); | |
49 | |
50 // Registration a commit contributor directly. Useful in tests. | |
Nicolas Zea
2013/12/18 22:36:10
Registration -> Register
rlarocque
2014/01/03 01:46:41
Done.
| |
51 void RegisterTypeForTest( | |
52 ModelType type, | |
53 SyncDirectoryCommitContributor* contributor); | |
54 | |
55 private: | |
56 typedef std::map<ModelType, SyncDirectoryCommitContributor*> | |
57 CommitContributorMap; | |
58 | |
59 // A map of 'commit contributors', one for each enabled type. | |
60 CommitContributorMap commit_contributor_map_; | |
61 | |
62 // Deleter for the |commit_contributor_map_|. | |
63 STLValueDeleter<CommitContributorMap> commit_contributor_deleter_; | |
64 }; | |
65 | |
66 } // namespace syncer | |
67 | |
68 #endif // SYNC_ENGINE_COMMITTER_LIST_H_ | |
OLD | NEW |