Chromium Code Reviews| Index: sync/engine/committer_list.h |
| diff --git a/sync/engine/committer_list.h b/sync/engine/committer_list.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4385b3744729c54b95fec6975551412ef0526c90 |
| --- /dev/null |
| +++ b/sync/engine/committer_list.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef SYNC_ENGINE_COMMITTER_LIST_H_ |
| +#define SYNC_ENGINE_COMMITTER_LIST_H_ |
| + |
| +#include <map> |
| +#include <vector> |
| + |
| +#include "base/stl_util.h" |
| +#include "sync/base/sync_export.h" |
| +#include "sync/internal_api/public/base/model_type.h" |
| +#include "sync/internal_api/public/engine/model_safe_worker.h" |
| + |
| +namespace syncer { |
| + |
| +namespace syncable { |
| +class Directory; |
| +} // namespace syncable |
| + |
| +class SyncDirectoryCommitContributor; |
| +class SyncDirectoryCommitContribution; |
| + |
| +// This class manages the set of per-type committer objects. |
| +// |
| +// It owns these types and hides the details of iterating over all of them. |
| +// Many methods allow the caller to specify a subset of types on which the |
| +// operation is to be applied. It is a logic error if the supplied set of types |
| +// contains a type which was not previously registered. |
| +class SYNC_EXPORT_PRIVATE CommitterList { |
| + public: |
| + typedef std::map<ModelType, SyncDirectoryCommitContribution*> ContributionMap; |
| + |
| + CommitterList(); |
| + ~CommitterList(); |
| + |
| + // Registers a commit contributor directly. |
| + void RegisterType( |
| + ModelType type, |
| + SyncDirectoryCommitContributor* contributor); |
| + |
| + // Gathers a set of contributions to be used to populate a commit message. |
| + void GatherCommitContributions( |
| + ModelTypeSet commit_types, |
| + size_t max_entries, |
| + ContributionMap* contributions); |
| + |
| + private: |
| + typedef std::map<ModelType, SyncDirectoryCommitContributor*> |
| + CommitContributorMap; |
| + |
| + // A map of 'commit contributors', one for each enabled type. |
| + CommitContributorMap commit_contributor_map_; |
| + |
| + // Deleter for the |commit_contributor_map_|. |
| + STLValueDeleter<CommitContributorMap> commit_contributor_deleter_; |
|
Nicolas Zea
2014/01/04 02:09:34
disallow copy and assign
rlarocque
2014/01/06 20:03:33
Done.
|
| +}; |
| + |
| +} // namespace syncer |
| + |
| +#endif // SYNC_ENGINE_COMMITTER_LIST_H_ |