Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: sync/internal_api/change_reorder_buffer.cc

Issue 11636006: WIP: The Bookmark Position Megapatch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Various updates, including switch suffix to unique_client_tag style Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/internal_api/base_node.cc ('k') | sync/internal_api/public/base/unique_position.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 Traversal::LinkSet::const_iterator j = traversal.begin_children(next); 193 Traversal::LinkSet::const_iterator j = traversal.begin_children(next);
194 Traversal::LinkSet::const_iterator end = traversal.end_children(next); 194 Traversal::LinkSet::const_iterator end = traversal.end_children(next);
195 for (; j != end; ++j) { 195 for (; j != end; ++j) {
196 CHECK(j->first == next); 196 CHECK(j->first == next);
197 to_visit.push(j->second); 197 to_visit.push(j->second);
198 } 198 }
199 } else { 199 } else {
200 // There were ordering changes on the children of this parent, so 200 // There were ordering changes on the children of this parent, so
201 // enumerate all the children in the sibling order. 201 // enumerate all the children in the sibling order.
202 syncable::Entry parent(trans, syncable::GET_BY_HANDLE, next); 202 syncable::Entry parent(trans, syncable::GET_BY_HANDLE, next);
203 syncable::Id id; 203 syncable::Id id = parent.GetFirstChildId();
204 if (!trans->directory()->GetFirstChildId(
205 trans, parent.Get(syncable::ID), &id)) {
206 *changes = ImmutableChangeRecordList();
207 return false;
208 }
209 while (!id.IsRoot()) { 204 while (!id.IsRoot()) {
210 syncable::Entry child(trans, syncable::GET_BY_ID, id); 205 syncable::Entry child(trans, syncable::GET_BY_ID, id);
211 CHECK(child.good()); 206 CHECK(child.good());
212 int64 handle = child.Get(syncable::META_HANDLE); 207 int64 handle = child.Get(syncable::META_HANDLE);
213 to_visit.push(handle); 208 to_visit.push(handle);
214 // If there is no operation on this child node, record it as as an 209 // If there is no operation on this child node, record it as as an
215 // update, so that the listener gets notified of all nodes in the new 210 // update, so that the listener gets notified of all nodes in the new
216 // ordering. 211 // ordering.
217 if (operations_.find(handle) == operations_.end()) 212 if (operations_.find(handle) == operations_.end())
218 operations_[handle] = OP_UPDATE_POSITION_AND_PROPERTIES; 213 operations_[handle] = OP_UPDATE_POSITION_AND_PROPERTIES;
219 id = child.Get(syncable::NEXT_ID); 214 id = child.GetSuccessorId();
220 } 215 }
221 } 216 }
222 } 217 }
223 218
224 *changes = ImmutableChangeRecordList(&changelist); 219 *changes = ImmutableChangeRecordList(&changelist);
225 return true; 220 return true;
226 } 221 }
227 222
228 } // namespace syncer 223 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/base_node.cc ('k') | sync/internal_api/public/base/unique_position.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698