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

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

Issue 1096983002: Update usages of std::map to use ScopedPtrMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@passwordmanager-scopedmemory
Patch Set: Rebase. Created 5 years, 5 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
« no previous file with comments | « sync/engine/commit.cc ('k') | sync/engine/commit_processor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SYNC_ENGINE_COMMIT_PROCESSOR_H_ 5 #ifndef SYNC_ENGINE_COMMIT_PROCESSOR_H_
6 #define SYNC_ENGINE_COMMIT_PROCESSOR_H_ 6 #define SYNC_ENGINE_COMMIT_PROCESSOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "sync/base/sync_export.h" 12 #include "sync/base/sync_export.h"
13 #include "sync/engine/commit.h"
13 #include "sync/internal_api/public/base/model_type.h" 14 #include "sync/internal_api/public/base/model_type.h"
14 #include "sync/internal_api/public/engine/model_safe_worker.h" 15 #include "sync/internal_api/public/engine/model_safe_worker.h"
15 #include "sync/sessions/model_type_registry.h" 16 #include "sync/sessions/model_type_registry.h"
16 17
17 namespace syncer { 18 namespace syncer {
18 19
19 namespace syncable { 20 namespace syncable {
20 class Directory; 21 class Directory;
21 } // namespace syncable 22 } // namespace syncable
22 23
23 class CommitContributor; 24 class CommitContributor;
24 class CommitContribution; 25 class CommitContribution;
25 26
26 // This class manages the set of per-type committer objects. 27 // This class manages the set of per-type committer objects.
27 // 28 //
28 // It owns these types and hides the details of iterating over all of them. 29 // It owns these types and hides the details of iterating over all of them.
29 // Many methods allow the caller to specify a subset of types on which the 30 // 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 // 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 // contains a type which was not previously registered.
32 class SYNC_EXPORT_PRIVATE CommitProcessor { 33 class SYNC_EXPORT_PRIVATE CommitProcessor {
33 public: 34 public:
34 typedef std::map<ModelType, CommitContribution*> ContributionMap;
35
36 // Contructs a CommitProcessor from a map of CommitContributors. 35 // Contructs a CommitProcessor from a map of CommitContributors.
37 // The CommitProcessor does not own this map. 36 // The CommitProcessor does not own this map.
38 explicit CommitProcessor(CommitContributorMap* commit_contributor_map); 37 explicit CommitProcessor(CommitContributorMap* commit_contributor_map);
39 ~CommitProcessor(); 38 ~CommitProcessor();
40 39
41 // Gathers a set of contributions to be used to populate a commit message. 40 // Gathers a set of contributions to be used to populate a commit message.
42 // 41 //
43 // For each of the |commit_types| in this CommitProcessor's CommitContributor 42 // For each of the |commit_types| in this CommitProcessor's CommitContributor
44 // map, gather any entries queued for commit into CommitContributions. The 43 // map, gather any entries queued for commit into CommitContributions. The
45 // total number of entries in all the returned CommitContributions shall not 44 // total number of entries in all the returned CommitContributions shall not
46 // exceed |max_entries|. 45 // exceed |max_entries|.
47 void GatherCommitContributions( 46 void GatherCommitContributions(ModelTypeSet commit_types,
48 ModelTypeSet commit_types, 47 size_t max_entries,
49 size_t max_entries, 48 Commit::ContributionMap* contributions);
50 ContributionMap* contributions);
51 49
52 private: 50 private:
53 // A map of 'commit contributors', one for each enabled type. 51 // A map of 'commit contributors', one for each enabled type.
54 CommitContributorMap* commit_contributor_map_; 52 CommitContributorMap* commit_contributor_map_;
55 53
56 DISALLOW_COPY_AND_ASSIGN(CommitProcessor); 54 DISALLOW_COPY_AND_ASSIGN(CommitProcessor);
57 }; 55 };
58 56
59 } // namespace syncer 57 } // namespace syncer
60 58
61 #endif // SYNC_ENGINE_COMMIT_PROCESSOR_H_ 59 #endif // SYNC_ENGINE_COMMIT_PROCESSOR_H_
OLDNEW
« no previous file with comments | « sync/engine/commit.cc ('k') | sync/engine/commit_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698