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

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

Issue 805633004: Enable Null Syncable ID which is different than Root ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 5 years, 12 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 | « sync/engine/syncer_util_unittest.cc ('k') | sync/internal_api/sync_manager_impl_unittest.cc » ('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/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 171
172 bool BaseNode::HasChildren() const { 172 bool BaseNode::HasChildren() const {
173 syncable::Directory* dir = GetTransaction()->GetDirectory(); 173 syncable::Directory* dir = GetTransaction()->GetDirectory();
174 syncable::BaseTransaction* trans = GetTransaction()->GetWrappedTrans(); 174 syncable::BaseTransaction* trans = GetTransaction()->GetWrappedTrans();
175 return dir->HasChildren(trans, GetEntry()->GetId()); 175 return dir->HasChildren(trans, GetEntry()->GetId());
176 } 176 }
177 177
178 int64 BaseNode::GetPredecessorId() const { 178 int64 BaseNode::GetPredecessorId() const {
179 syncable::Id id_string = GetEntry()->GetPredecessorId(); 179 syncable::Id id_string = GetEntry()->GetPredecessorId();
180 if (id_string.IsRoot()) 180 if (id_string.IsNull())
181 return kInvalidId; 181 return kInvalidId;
182 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string); 182 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string);
183 } 183 }
184 184
185 int64 BaseNode::GetSuccessorId() const { 185 int64 BaseNode::GetSuccessorId() const {
186 syncable::Id id_string = GetEntry()->GetSuccessorId(); 186 syncable::Id id_string = GetEntry()->GetSuccessorId();
187 if (id_string.IsRoot()) 187 if (id_string.IsNull())
188 return kInvalidId; 188 return kInvalidId;
189 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string); 189 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string);
190 } 190 }
191 191
192 int64 BaseNode::GetFirstChildId() const { 192 int64 BaseNode::GetFirstChildId() const {
193 syncable::Id id_string = GetEntry()->GetFirstChildId(); 193 syncable::Id id_string = GetEntry()->GetFirstChildId();
194 if (id_string.IsRoot()) 194 if (id_string.IsNull())
195 return kInvalidId; 195 return kInvalidId;
196 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string); 196 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string);
197 } 197 }
198 198
199 void BaseNode::GetChildIds(std::vector<int64>* result) const { 199 void BaseNode::GetChildIds(std::vector<int64>* result) const {
200 GetEntry()->GetChildHandles(result); 200 GetEntry()->GetChildHandles(result);
201 } 201 }
202 202
203 int BaseNode::GetTotalNodeCount() const { 203 int BaseNode::GetTotalNodeCount() const {
204 return GetEntry()->GetTotalNodeCount(); 204 return GetEntry()->GetTotalNodeCount();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 const sync_pb::EntitySpecifics& specifics) { 304 const sync_pb::EntitySpecifics& specifics) {
305 ModelType type = GetModelTypeFromSpecifics(specifics); 305 ModelType type = GetModelTypeFromSpecifics(specifics);
306 DCHECK_NE(UNSPECIFIED, type); 306 DCHECK_NE(UNSPECIFIED, type);
307 if (GetModelType() != UNSPECIFIED) { 307 if (GetModelType() != UNSPECIFIED) {
308 DCHECK_EQ(GetModelType(), type); 308 DCHECK_EQ(GetModelType(), type);
309 } 309 }
310 unencrypted_data_.CopyFrom(specifics); 310 unencrypted_data_.CopyFrom(specifics);
311 } 311 }
312 312
313 } // namespace syncer 313 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer_util_unittest.cc ('k') | sync/internal_api/sync_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698