Chromium Code Reviews| 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/basictypes.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 SyncDirectoryCommitContributor; | |
| 24 class SyncDirectoryCommitContribution; | |
| 25 | |
| 26 // This class manages the set of per-type committer objects. | |
| 27 // | |
| 28 // It owns these types and hides the details of iterating over all of them. | |
|
tim (not reviewing)
2014/01/08 19:33:42
Stuff responsible for shielding engine/ code from
rlarocque
2014/01/09 00:31:18
Can we defer the move to a future CL? That way we
| |
| 29 // Many methods allow the caller to specify a subset of types on which the | |
| 30 // operation is to be applied. It is a logic error if the supplied set of types | |
| 31 // contains a type which was not previously registered. | |
| 32 class SYNC_EXPORT_PRIVATE CommitterList { | |
|
tim (not reviewing)
2014/01/08 19:33:42
(if you've read my UpdaterList comment, CommitterL
| |
| 33 public: | |
| 34 typedef std::map<ModelType, SyncDirectoryCommitContribution*> ContributionMap; | |
| 35 | |
| 36 CommitterList(); | |
| 37 ~CommitterList(); | |
| 38 | |
| 39 // Registers a commit contributor directly. | |
| 40 void RegisterType( | |
| 41 ModelType type, | |
| 42 SyncDirectoryCommitContributor* contributor); | |
| 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 private: | |
| 51 typedef std::map<ModelType, SyncDirectoryCommitContributor*> | |
| 52 CommitContributorMap; | |
| 53 | |
| 54 // A map of 'commit contributors', one for each enabled type. | |
| 55 CommitContributorMap commit_contributor_map_; | |
| 56 | |
| 57 // Deleter for the |commit_contributor_map_|. | |
| 58 STLValueDeleter<CommitContributorMap> commit_contributor_deleter_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(CommitterList); | |
| 61 }; | |
| 62 | |
| 63 } // namespace syncer | |
| 64 | |
| 65 #endif // SYNC_ENGINE_COMMITTER_LIST_H_ | |
| OLD | NEW |