| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/sync/engine/update_applicator.h" | 5 #include "chrome/browser/sync/engine/update_applicator.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/sync/engine/syncer_util.h" | 10 #include "chrome/browser/sync/engine/syncer_util.h" |
| 11 #include "chrome/browser/sync/sessions/session_state.h" |
| 11 #include "chrome/browser/sync/syncable/syncable.h" | 12 #include "chrome/browser/sync/syncable/syncable.h" |
| 12 #include "chrome/browser/sync/syncable/syncable_id.h" | 13 #include "chrome/browser/sync/syncable/syncable_id.h" |
| 13 | 14 |
| 14 using std::vector; | 15 using std::vector; |
| 15 | 16 |
| 16 namespace browser_sync { | 17 namespace browser_sync { |
| 17 | 18 |
| 18 UpdateApplicator::UpdateApplicator(ConflictResolver* resolver, | 19 UpdateApplicator::UpdateApplicator(ConflictResolver* resolver, |
| 19 const UpdateIterator& begin, | 20 const UpdateIterator& begin, |
| 20 const UpdateIterator& end) | 21 const UpdateIterator& end) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 LOG(INFO) << "Apply Status for " << entry.Get(syncable::META_HANDLE) | 67 LOG(INFO) << "Apply Status for " << entry.Get(syncable::META_HANDLE) |
| 67 << " is " << updateResponse; | 68 << " is " << updateResponse; |
| 68 | 69 |
| 69 return true; | 70 return true; |
| 70 } | 71 } |
| 71 | 72 |
| 72 bool UpdateApplicator::AllUpdatesApplied() const { | 73 bool UpdateApplicator::AllUpdatesApplied() const { |
| 73 return conflicting_ids_.empty() && begin_ == end_; | 74 return conflicting_ids_.empty() && begin_ == end_; |
| 74 } | 75 } |
| 75 | 76 |
| 76 void UpdateApplicator::SaveProgressIntoSessionState(SyncerSession* session) { | 77 void UpdateApplicator::SaveProgressIntoSessionState( |
| 78 sessions::ConflictProgress* conflict_progress, |
| 79 sessions::UpdateProgress* update_progress) { |
| 77 DCHECK(begin_ == end_ || ((pointer_ == end_) && !progress_)) | 80 DCHECK(begin_ == end_ || ((pointer_ == end_) && !progress_)) |
| 78 << "SaveProgress called before updates exhausted."; | 81 << "SaveProgress called before updates exhausted."; |
| 79 | 82 |
| 80 vector<syncable::Id>::const_iterator i; | 83 vector<syncable::Id>::const_iterator i; |
| 81 for (i = conflicting_ids_.begin(); i != conflicting_ids_.end(); ++i) { | 84 for (i = conflicting_ids_.begin(); i != conflicting_ids_.end(); ++i) { |
| 82 session->AddCommitConflict(*i); | 85 conflict_progress->AddConflictingItemById(*i); |
| 83 session->AddAppliedUpdate(CONFLICT, *i); | 86 update_progress->AddAppliedUpdate(CONFLICT, *i); |
| 84 } | 87 } |
| 85 for (i = successful_ids_.begin(); i != successful_ids_.end(); ++i) { | 88 for (i = successful_ids_.begin(); i != successful_ids_.end(); ++i) { |
| 86 session->EraseCommitConflict(*i); | 89 conflict_progress->EraseConflictingItemById(*i); |
| 87 session->AddAppliedUpdate(SUCCESS, *i); | 90 update_progress->AddAppliedUpdate(SUCCESS, *i); |
| 88 } | 91 } |
| 89 } | 92 } |
| 90 | 93 |
| 91 } // namespace browser_sync | 94 } // namespace browser_sync |
| OLD | NEW |