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

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

Issue 14667013: sync: Better iteration in GenericChangeProcessor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes Created 7 years, 7 months 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
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | sync/internal_api/public/base_node.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/public/base_node.h" 5 #include "sync/internal_api/public/base_node.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string); 208 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string);
209 } 209 }
210 210
211 int64 BaseNode::GetFirstChildId() const { 211 int64 BaseNode::GetFirstChildId() const {
212 syncable::Id id_string = GetEntry()->GetFirstChildId(); 212 syncable::Id id_string = GetEntry()->GetFirstChildId();
213 if (id_string.IsRoot()) 213 if (id_string.IsRoot())
214 return kInvalidId; 214 return kInvalidId;
215 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string); 215 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string);
216 } 216 }
217 217
218 void BaseNode::GetChildIds(std::vector<int64>* result) const {
219 GetEntry()->GetChildHandles(result);
220 }
221
218 int BaseNode::GetTotalNodeCount() const { 222 int BaseNode::GetTotalNodeCount() const {
219 syncable::BaseTransaction* trans = GetTransaction()->GetWrappedTrans(); 223 syncable::BaseTransaction* trans = GetTransaction()->GetWrappedTrans();
220 224
221 int count = 1; // Start with one to include the node itself. 225 int count = 1; // Start with one to include the node itself.
222 226
223 std::stack<int64> stack; 227 std::stack<int64> stack;
224 stack.push(GetFirstChildId()); 228 stack.push(GetFirstChildId());
225 while (!stack.empty()) { 229 while (!stack.empty()) {
226 int64 handle = stack.top(); 230 int64 handle = stack.top();
227 stack.pop(); 231 stack.pop();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 const sync_pb::EntitySpecifics& specifics) { 367 const sync_pb::EntitySpecifics& specifics) {
364 ModelType type = GetModelTypeFromSpecifics(specifics); 368 ModelType type = GetModelTypeFromSpecifics(specifics);
365 DCHECK_NE(UNSPECIFIED, type); 369 DCHECK_NE(UNSPECIFIED, type);
366 if (GetModelType() != UNSPECIFIED) { 370 if (GetModelType() != UNSPECIFIED) {
367 DCHECK_EQ(GetModelType(), type); 371 DCHECK_EQ(GetModelType(), type);
368 } 372 }
369 unencrypted_data_.CopyFrom(specifics); 373 unencrypted_data_.CopyFrom(specifics);
370 } 374 }
371 375
372 } // namespace syncer 376 } // namespace syncer
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | sync/internal_api/public/base_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698