| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // An UpdateApplicator is used to iterate over a number of unapplied updates, | 5 // An UpdateApplicator is used to iterate over a number of unapplied updates, |
| 6 // applying them to the client using the given syncer session. | 6 // applying them to the client using the given syncer session. |
| 7 // | 7 // |
| 8 // UpdateApplicator might resemble an iterator, but it actually keeps retrying | 8 // UpdateApplicator might resemble an iterator, but it actually keeps retrying |
| 9 // failed updates until no remaining updates can be successfully applied. | 9 // failed updates until no remaining updates can be successfully applied. |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 sessions::UpdateProgress* update_progress); | 56 sessions::UpdateProgress* update_progress); |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 // Track the status of all applications. | 59 // Track the status of all applications. |
| 60 // We treat encryption conflicts as nonblocking conflict items when we save | 60 // We treat encryption conflicts as nonblocking conflict items when we save |
| 61 // progress. | 61 // progress. |
| 62 class ResultTracker { | 62 class ResultTracker { |
| 63 public: | 63 public: |
| 64 explicit ResultTracker(size_t num_results); | 64 explicit ResultTracker(size_t num_results); |
| 65 virtual ~ResultTracker(); | 65 virtual ~ResultTracker(); |
| 66 void AddConflict(syncable::Id); | 66 void AddSimpleConflict(syncable::Id); |
| 67 void AddEncryptionConflict(syncable::Id); | 67 void AddEncryptionConflict(syncable::Id); |
| 68 void AddHierarchyConflict(syncable::Id); |
| 68 void AddSuccess(syncable::Id); | 69 void AddSuccess(syncable::Id); |
| 69 void SaveProgress(sessions::ConflictProgress* conflict_progress, | 70 void SaveProgress(sessions::ConflictProgress* conflict_progress, |
| 70 sessions::UpdateProgress* update_progress); | 71 sessions::UpdateProgress* update_progress); |
| 71 void ClearConflicts(); | 72 void ClearConflicts(); |
| 72 | 73 |
| 73 // Returns true iff conflicting_ids_ is empty. Does not check | 74 // Returns true iff conflicting_ids_ is empty. Does not check |
| 74 // encryption_conflict_ids_. | 75 // encryption_conflict_ids_. |
| 75 bool no_conflicts() const; | 76 bool no_conflicts() const; |
| 76 private: | 77 private: |
| 77 std::vector<syncable::Id> conflicting_ids_; | 78 std::vector<syncable::Id> conflicting_ids_; |
| 78 std::vector<syncable::Id> successful_ids_; | 79 std::vector<syncable::Id> successful_ids_; |
| 79 std::vector<syncable::Id> encryption_conflict_ids_; | 80 std::vector<syncable::Id> encryption_conflict_ids_; |
| 81 std::vector<syncable::Id> hierarchy_conflict_ids_; |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 // If true, AttemptOneApplication will skip over |entry| and return true. | 84 // If true, AttemptOneApplication will skip over |entry| and return true. |
| 83 bool SkipUpdate(const syncable::Entry& entry); | 85 bool SkipUpdate(const syncable::Entry& entry); |
| 84 | 86 |
| 85 // Adjusts the UpdateIterator members to move ahead by one update. | 87 // Adjusts the UpdateIterator members to move ahead by one update. |
| 86 void Advance(); | 88 void Advance(); |
| 87 | 89 |
| 88 // Used to resolve conflicts when trying to apply updates. | 90 // Used to resolve conflicts when trying to apply updates. |
| 89 ConflictResolver* const resolver_; | 91 ConflictResolver* const resolver_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 101 | 103 |
| 102 // Track the result of the attempts to update applications. | 104 // Track the result of the attempts to update applications. |
| 103 ResultTracker application_results_; | 105 ResultTracker application_results_; |
| 104 | 106 |
| 105 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); | 107 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 } // namespace browser_sync | 110 } // namespace browser_sync |
| 109 | 111 |
| 110 #endif // CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_ | 112 #endif // CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_ |
| OLD | NEW |