| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // | |
| 5 // An UpdateApplicator is used to iterate over a number of unapplied updates, | |
| 6 // applying them to the client using the given syncer cycle. | |
| 7 // | |
| 8 // UpdateApplicator might resemble an iterator, but it actually keeps retrying | |
| 9 // failed updates until no remaining updates can be successfully applied. | |
| 10 | 4 |
| 11 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_UPDATE_APPLICATOR_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_UPDATE_APPLICATOR_H_ |
| 12 #define COMPONENTS_SYNC_ENGINE_IMPL_UPDATE_APPLICATOR_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_UPDATE_APPLICATOR_H_ |
| 13 | 7 |
| 14 #include <stdint.h> | 8 #include <stdint.h> |
| 15 | 9 |
| 16 #include <set> | 10 #include <set> |
| 17 #include <vector> | 11 #include <vector> |
| 18 | 12 |
| 19 #include "base/macros.h" | 13 #include "base/macros.h" |
| 20 #include "components/sync/engine/model_safe_worker.h" | 14 #include "components/sync/engine/model_safe_worker.h" |
| 21 #include "components/sync/syncable/syncable_id.h" | 15 #include "components/sync/syncable/syncable_id.h" |
| 22 | 16 |
| 23 namespace syncer { | 17 namespace syncer { |
| 24 | 18 |
| 25 class Cryptographer; | 19 class Cryptographer; |
| 26 | 20 |
| 27 namespace syncable { | 21 namespace syncable { |
| 28 class WriteTransaction; | 22 class WriteTransaction; |
| 29 class Entry; | 23 class Entry; |
| 30 } | 24 } |
| 31 | 25 |
| 26 // An UpdateApplicator is used to iterate over a number of unapplied updates, |
| 27 // applying them to the client using the given syncer cycle. |
| 28 // |
| 29 // UpdateApplicator might resemble an iterator, but it actually keeps retrying |
| 30 // failed updates until no remaining updates can be successfully applied. |
| 32 class UpdateApplicator { | 31 class UpdateApplicator { |
| 33 public: | 32 public: |
| 34 explicit UpdateApplicator(Cryptographer* cryptographer); | 33 explicit UpdateApplicator(Cryptographer* cryptographer); |
| 35 ~UpdateApplicator(); | 34 ~UpdateApplicator(); |
| 36 | 35 |
| 37 // Attempt to apply the specified updates. | 36 // Attempt to apply the specified updates. |
| 38 void AttemptApplications(syncable::WriteTransaction* trans, | 37 void AttemptApplications(syncable::WriteTransaction* trans, |
| 39 const std::vector<int64_t>& handles); | 38 const std::vector<int64_t>& handles); |
| 40 | 39 |
| 41 int updates_applied() { return updates_applied_; } | 40 int updates_applied() { return updates_applied_; } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 59 int encryption_conflicts_; | 58 int encryption_conflicts_; |
| 60 int hierarchy_conflicts_; | 59 int hierarchy_conflicts_; |
| 61 std::set<syncable::Id> simple_conflict_ids_; | 60 std::set<syncable::Id> simple_conflict_ids_; |
| 62 | 61 |
| 63 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); | 62 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 } // namespace syncer | 65 } // namespace syncer |
| 67 | 66 |
| 68 #endif // COMPONENTS_SYNC_ENGINE_IMPL_UPDATE_APPLICATOR_H_ | 67 #endif // COMPONENTS_SYNC_ENGINE_IMPL_UPDATE_APPLICATOR_H_ |
| OLD | NEW |