Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Side by Side Diff: sync/engine/committer_list.h

Issue 93433006: sync: Introduce ModelTypeRegistry and helpers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing files Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 // This class manages the set of per-type committer objects.
26 //
27 // It owns these types and hides the details of iterating over all of them.
28 // Many methods allow the caller to specify a subset of types on which the
29 // operation is to be applied. It is a logic error if the supplied set of types
30 // contains a type which was not previously registered.
31 class SYNC_EXPORT_PRIVATE CommitterList {
32 public:
33 typedef std::map<ModelType, SyncDirectoryCommitContribution*> ContributionMap;
34
35 CommitterList();
36 ~CommitterList();
37
38 // Registers a commit contributor directly.
39 void RegisterType(
40 ModelType type,
41 SyncDirectoryCommitContributor* contributor);
42
43 // Gathers a set of contributions to be used to populate a commit message.
44 void GatherCommitContributions(
45 ModelTypeSet commit_types,
46 size_t max_entries,
47 ContributionMap* contributions);
48
49 private:
50 typedef std::map<ModelType, SyncDirectoryCommitContributor*>
51 CommitContributorMap;
52
53 // A map of 'commit contributors', one for each enabled type.
54 CommitContributorMap commit_contributor_map_;
55
56 // Deleter for the |commit_contributor_map_|.
57 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.
58 };
59
60 } // namespace syncer
61
62 #endif // SYNC_ENGINE_COMMITTER_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698