Index: sync/internal_api/base_node.cc |
diff --git a/sync/internal_api/base_node.cc b/sync/internal_api/base_node.cc |
index 88dec8cbd36f474241e3a21fe65cf146d50dde6c..bc9443d3f7af17117ea7a01de29540ad9eed3ac8 100644 |
--- a/sync/internal_api/base_node.cc |
+++ b/sync/internal_api/base_node.cc |
@@ -216,31 +216,7 @@ int64 BaseNode::GetFirstChildId() const { |
} |
int BaseNode::GetTotalNodeCount() const { |
- syncable::BaseTransaction* trans = GetTransaction()->GetWrappedTrans(); |
- |
- int count = 1; // Start with one to include the node itself. |
- |
- std::stack<int64> stack; |
- stack.push(GetFirstChildId()); |
- while (!stack.empty()) { |
- int64 handle = stack.top(); |
- stack.pop(); |
- if (handle == kInvalidId) |
- continue; |
- count++; |
- syncable::Entry entry(trans, syncable::GET_BY_HANDLE, handle); |
- if (!entry.good()) |
- continue; |
- syncable::Id successor_id = entry.GetSuccessorId(); |
- if (!successor_id.IsRoot()) |
- stack.push(IdToMetahandle(trans, successor_id)); |
- if (!entry.Get(syncable::IS_DIR)) |
- continue; |
- syncable::Id child_id = entry.GetFirstChildId(); |
- if (!child_id.IsRoot()) |
- stack.push(IdToMetahandle(trans, child_id)); |
- } |
- return count; |
+ return GetEntry()->GetTotalNodeCount(); |
} |
DictionaryValue* BaseNode::GetSummaryAsValue() const { |