| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef SYNC_ENGINE_COMMIT_PROCESSOR_H_ | |
| 6 #define SYNC_ENGINE_COMMIT_PROCESSOR_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include <map> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/macros.h" | |
| 14 #include "sync/base/sync_export.h" | |
| 15 #include "sync/engine/commit.h" | |
| 16 #include "sync/internal_api/public/base/model_type.h" | |
| 17 #include "sync/internal_api/public/engine/model_safe_worker.h" | |
| 18 #include "sync/sessions/model_type_registry.h" | |
| 19 | |
| 20 namespace syncer { | |
| 21 | |
| 22 namespace syncable { | |
| 23 class Directory; | |
| 24 } // namespace syncable | |
| 25 | |
| 26 class CommitContributor; | |
| 27 class CommitContribution; | |
| 28 | |
| 29 // This class manages the set of per-type committer objects. | |
| 30 // | |
| 31 // It owns these types and hides the details of iterating over all of them. | |
| 32 // Many methods allow the caller to specify a subset of types on which the | |
| 33 // operation is to be applied. It is a logic error if the supplied set of types | |
| 34 // contains a type which was not previously registered. | |
| 35 class SYNC_EXPORT CommitProcessor { | |
| 36 public: | |
| 37 // Contructs a CommitProcessor from a map of CommitContributors. | |
| 38 // The CommitProcessor does not own this map. | |
| 39 explicit CommitProcessor(CommitContributorMap* commit_contributor_map); | |
| 40 ~CommitProcessor(); | |
| 41 | |
| 42 // Gathers a set of contributions to be used to populate a commit message. | |
| 43 // | |
| 44 // For each of the |commit_types| in this CommitProcessor's CommitContributor | |
| 45 // map, gather any entries queued for commit into CommitContributions. The | |
| 46 // total number of entries in all the returned CommitContributions shall not | |
| 47 // exceed |max_entries|. | |
| 48 // Note: |cookie_jar_mismatch| and |cookie_jar_empty| are used only for | |
| 49 // metrics recording purposes specific to the SESSIONS type. | |
| 50 void GatherCommitContributions(ModelTypeSet commit_types, | |
| 51 size_t max_entries, | |
| 52 bool cookie_jar_mismatch, | |
| 53 bool cookie_jar_empty, | |
| 54 Commit::ContributionMap* contributions); | |
| 55 | |
| 56 private: | |
| 57 // A map of 'commit contributors', one for each enabled type. | |
| 58 CommitContributorMap* commit_contributor_map_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(CommitProcessor); | |
| 61 }; | |
| 62 | |
| 63 } // namespace syncer | |
| 64 | |
| 65 #endif // SYNC_ENGINE_COMMIT_PROCESSOR_H_ | |
| OLD | NEW |