Add an exponential backoff to rechecking the app list doodle.
[chromium-blink-merge.git] / sync / engine / commit_processor.h
blobc3af5d814455e9069383d7f3adef18b87fcd6769
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
3 // found in the LICENSE file.
5 #ifndef SYNC_ENGINE_COMMIT_PROCESSOR_H_
6 #define SYNC_ENGINE_COMMIT_PROCESSOR_H_
8 #include <map>
9 #include <vector>
11 #include "base/basictypes.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 #include "sync/sessions/model_type_registry.h"
17 namespace syncer {
19 namespace syncable {
20 class Directory;
21 } // namespace syncable
23 class CommitContributor;
24 class CommitContribution;
26 // This class manages the set of per-type committer objects.
28 // 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 // 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 CommitProcessor {
33 public:
34 typedef std::map<ModelType, CommitContribution*> ContributionMap;
36 // Contructs a CommitProcessor from a map of CommitContributors.
37 // The CommitProcessor does not own this map.
38 explicit CommitProcessor(CommitContributorMap* commit_contributor_map);
39 ~CommitProcessor();
41 // Gathers a set of contributions to be used to populate a commit message.
43 // For each of the |commit_types| in this CommitProcessor's CommitContributor
44 // map, gather any entries queued for commit into CommitContributions. The
45 // total number of entries in all the returned CommitContributions shall not
46 // exceed |max_entries|.
47 void GatherCommitContributions(
48 ModelTypeSet commit_types,
49 size_t max_entries,
50 ContributionMap* contributions);
52 private:
53 // A map of 'commit contributors', one for each enabled type.
54 CommitContributorMap* commit_contributor_map_;
56 DISALLOW_COPY_AND_ASSIGN(CommitProcessor);
59 } // namespace syncer
61 #endif // SYNC_ENGINE_COMMIT_PROCESSOR_H_