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

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

Issue 8402014: [Sync] Make GetFirstChildId return a flag indicating success (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup comments Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/internal_api/base_node.h" 5 #include "chrome/browser/sync/internal_api/base_node.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 int64 BaseNode::GetSuccessorId() const { 217 int64 BaseNode::GetSuccessorId() const {
218 syncable::Id id_string = GetEntry()->Get(syncable::NEXT_ID); 218 syncable::Id id_string = GetEntry()->Get(syncable::NEXT_ID);
219 if (id_string.IsRoot()) 219 if (id_string.IsRoot())
220 return kInvalidId; 220 return kInvalidId;
221 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string); 221 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string);
222 } 222 }
223 223
224 int64 BaseNode::GetFirstChildId() const { 224 int64 BaseNode::GetFirstChildId() const {
225 syncable::Directory* dir = GetTransaction()->GetLookup(); 225 syncable::Directory* dir = GetTransaction()->GetLookup();
226 syncable::BaseTransaction* trans = GetTransaction()->GetWrappedTrans(); 226 syncable::BaseTransaction* trans = GetTransaction()->GetWrappedTrans();
227 syncable::Id id_string = 227 syncable::Id id_string;
228 dir->GetFirstChildId(trans, GetEntry()->Get(syncable::ID)); 228 // TODO(akalin): Propagate up the error further (see
229 // http://crbug.com/100907).
230 CHECK(dir->GetFirstChildId(trans,
231 GetEntry()->Get(syncable::ID), &id_string));
229 if (id_string.IsRoot()) 232 if (id_string.IsRoot())
230 return kInvalidId; 233 return kInvalidId;
231 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string); 234 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string);
232 } 235 }
233 236
234 DictionaryValue* BaseNode::GetSummaryAsValue() const { 237 DictionaryValue* BaseNode::GetSummaryAsValue() const {
235 DictionaryValue* node_info = new DictionaryValue(); 238 DictionaryValue* node_info = new DictionaryValue();
236 node_info->SetString("id", base::Int64ToString(GetId())); 239 node_info->SetString("id", base::Int64ToString(GetId()));
237 node_info->SetBoolean("isFolder", GetIsFolder()); 240 node_info->SetBoolean("isFolder", GetIsFolder());
238 node_info->SetString("title", GetTitle()); 241 node_info->SetString("title", GetTitle());
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 const sync_pb::EntitySpecifics& specifics) { 338 const sync_pb::EntitySpecifics& specifics) {
336 syncable::ModelType type = syncable::GetModelTypeFromSpecifics(specifics); 339 syncable::ModelType type = syncable::GetModelTypeFromSpecifics(specifics);
337 DCHECK_NE(syncable::UNSPECIFIED, type); 340 DCHECK_NE(syncable::UNSPECIFIED, type);
338 if (GetModelType() != syncable::UNSPECIFIED) { 341 if (GetModelType() != syncable::UNSPECIFIED) {
339 DCHECK_EQ(GetModelType(), type); 342 DCHECK_EQ(GetModelType(), type);
340 } 343 }
341 unencrypted_data_.CopyFrom(specifics); 344 unencrypted_data_.CopyFrom(specifics);
342 } 345 }
343 346
344 } // namespace sync_api 347 } // namespace sync_api
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698