| 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 | 4 |
| 5 #include "sync/internal_api/change_reorder_buffer.h" | 5 #include "sync/internal_api/change_reorder_buffer.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 record.extra = extra_data_[record.id]; | 147 record.extra = extra_data_[record.id]; |
| 148 changelist.push_back(record); | 148 changelist.push_back(record); |
| 149 } else { | 149 } else { |
| 150 traversal.ExpandToInclude(trans, i->first); | 150 traversal.ExpandToInclude(trans, i->first); |
| 151 if (i->second == OP_ADD || | 151 if (i->second == OP_ADD || |
| 152 i->second == OP_UPDATE_POSITION_AND_PROPERTIES) { | 152 i->second == OP_UPDATE_POSITION_AND_PROPERTIES) { |
| 153 ReadNode node(sync_trans); | 153 ReadNode node(sync_trans); |
| 154 CHECK_EQ(BaseNode::INIT_OK, node.InitByIdLookup(i->first)); | 154 CHECK_EQ(BaseNode::INIT_OK, node.InitByIdLookup(i->first)); |
| 155 | 155 |
| 156 // We only care about parents of entry's with position-sensitive models. | 156 // We only care about parents of entry's with position-sensitive models. |
| 157 if (syncer::ShouldMaintainPosition(node.GetEntry()->GetModelType())) { | 157 if (ShouldMaintainPosition(node.GetEntry()->GetModelType())) { |
| 158 parents_of_position_changes.insert(node.GetParentId()); | 158 parents_of_position_changes.insert(node.GetParentId()); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Step 2: Breadth-first expansion of the traversal, enumerating children in | 164 // Step 2: Breadth-first expansion of the traversal, enumerating children in |
| 165 // the syncable sibling order if there were any position updates. | 165 // the syncable sibling order if there were any position updates. |
| 166 queue<int64> to_visit; | 166 queue<int64> to_visit; |
| 167 to_visit.push(traversal.top()); | 167 to_visit.push(traversal.top()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 id = child.Get(syncable::NEXT_ID); | 219 id = child.Get(syncable::NEXT_ID); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 *changes = ImmutableChangeRecordList(&changelist); | 224 *changes = ImmutableChangeRecordList(&changelist); |
| 225 return true; | 225 return true; |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace syncer | 228 } // namespace syncer |
| OLD | NEW |