OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
88 void UpdateApplicator::Advance() { | 88 void UpdateApplicator::Advance() { |
89 --end_; | 89 --end_; |
90 *pointer_ = *end_; | 90 *pointer_ = *end_; |
91 } | 91 } |
92 | 92 |
93 bool UpdateApplicator::SkipUpdate(const syncable::Entry& entry) { | 93 bool UpdateApplicator::SkipUpdate(const syncable::Entry& entry) { |
94 ModelSafeGroup g = | 94 syncable::ModelType type = entry.GetServerModelType(); |
95 GetGroupForModelType(entry.GetServerModelType(), routing_info_); | 95 ModelSafeGroup g = GetGroupForModelType(type, routing_info_); |
| 96 // The extra routing_info count check here is to support GetUpdateses for |
| 97 // a subset of the globally enabled types, and not attempt to update items |
| 98 // if their type isn't permitted in the current run. These would typically |
| 99 // be unapplied items from a previous sync. |
96 if (g != group_filter_) | 100 if (g != group_filter_) |
97 return true; | 101 return true; |
| 102 if (g == GROUP_PASSIVE && |
| 103 !routing_info_.count(type) && |
| 104 type != syncable::UNSPECIFIED && |
| 105 type != syncable::TOP_LEVEL_FOLDER) { |
| 106 VLOG(1) << "Skipping update application, type not permitted."; |
| 107 return true; |
| 108 } |
98 return false; | 109 return false; |
99 } | 110 } |
100 | 111 |
101 bool UpdateApplicator::AllUpdatesApplied() const { | 112 bool UpdateApplicator::AllUpdatesApplied() const { |
102 return conflicting_ids_.empty() && begin_ == end_; | 113 return conflicting_ids_.empty() && begin_ == end_; |
103 } | 114 } |
104 | 115 |
105 void UpdateApplicator::SaveProgressIntoSessionState( | 116 void UpdateApplicator::SaveProgressIntoSessionState( |
106 sessions::ConflictProgress* conflict_progress, | 117 sessions::ConflictProgress* conflict_progress, |
107 sessions::UpdateProgress* update_progress) { | 118 sessions::UpdateProgress* update_progress) { |
108 DCHECK(begin_ == end_ || ((pointer_ == end_) && !progress_)) | 119 DCHECK(begin_ == end_ || ((pointer_ == end_) && !progress_)) |
109 << "SaveProgress called before updates exhausted."; | 120 << "SaveProgress called before updates exhausted."; |
110 | 121 |
111 vector<syncable::Id>::const_iterator i; | 122 vector<syncable::Id>::const_iterator i; |
112 for (i = conflicting_ids_.begin(); i != conflicting_ids_.end(); ++i) { | 123 for (i = conflicting_ids_.begin(); i != conflicting_ids_.end(); ++i) { |
113 conflict_progress->AddConflictingItemById(*i); | 124 conflict_progress->AddConflictingItemById(*i); |
114 update_progress->AddAppliedUpdate(CONFLICT, *i); | 125 update_progress->AddAppliedUpdate(CONFLICT, *i); |
115 } | 126 } |
116 for (i = successful_ids_.begin(); i != successful_ids_.end(); ++i) { | 127 for (i = successful_ids_.begin(); i != successful_ids_.end(); ++i) { |
117 conflict_progress->EraseConflictingItemById(*i); | 128 conflict_progress->EraseConflictingItemById(*i); |
118 update_progress->AddAppliedUpdate(SUCCESS, *i); | 129 update_progress->AddAppliedUpdate(SUCCESS, *i); |
119 } | 130 } |
120 } | 131 } |
121 | 132 |
122 } // namespace browser_sync | 133 } // namespace browser_sync |
OLD | NEW |