| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |