Update V8 to version 4.7.58.
[chromium-blink-merge.git] / sync / engine / update_applicator.h
blob55534ad15b21c2d5f81184305874eea237996eb7
1 // Copyright (c) 2012 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 // An UpdateApplicator is used to iterate over a number of unapplied updates,
6 // applying them to the client using the given syncer session.
7 //
8 // UpdateApplicator might resemble an iterator, but it actually keeps retrying
9 // failed updates until no remaining updates can be successfully applied.
11 #ifndef SYNC_ENGINE_UPDATE_APPLICATOR_H_
12 #define SYNC_ENGINE_UPDATE_APPLICATOR_H_
14 #include <vector>
16 #include "base/basictypes.h"
17 #include "sync/internal_api/public/engine/model_safe_worker.h"
18 #include "sync/syncable/syncable_id.h"
19 #include "sync/sessions/status_controller.h"
21 namespace syncer {
23 namespace sessions {
24 class StatusController;
27 namespace syncable {
28 class WriteTransaction;
29 class Entry;
32 class ConflictResolver;
33 class Cryptographer;
35 class UpdateApplicator {
36 public:
37 UpdateApplicator(Cryptographer* cryptographer);
38 ~UpdateApplicator();
40 // Attempt to apply the specified updates.
41 void AttemptApplications(syncable::WriteTransaction* trans,
42 const std::vector<int64>& handles);
44 int updates_applied() {
45 return updates_applied_;
48 int encryption_conflicts() {
49 return encryption_conflicts_;
52 int hierarchy_conflicts() {
53 return hierarchy_conflicts_;
56 const std::set<syncable::Id>& simple_conflict_ids() {
57 return simple_conflict_ids_;
60 private:
61 // If true, AttemptOneApplication will skip over |entry| and return true.
62 bool SkipUpdate(const syncable::Entry& entry);
64 // Used to decrypt sensitive sync nodes.
65 Cryptographer* cryptographer_;
67 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator);
69 int updates_applied_;
70 int encryption_conflicts_;
71 int hierarchy_conflicts_;
72 std::set<syncable::Id> simple_conflict_ids_;
75 } // namespace syncer
77 #endif // SYNC_ENGINE_UPDATE_APPLICATOR_H_