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

Side by Side Diff: components/sync/syncable/write_node.cc

Issue 2427803002: [Sync] Replacing NULL with nullptr in code and null in comments for components/sync/ (Closed)
Patch Set: Fixing start of sentence capitlization. Created 4 years, 2 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 | « components/sync/syncable/write_node.h ('k') | components/sync/syncable/write_transaction.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 "components/sync/syncable/write_node.h" 5 #include "components/sync/syncable/write_node.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 entity_specifics.mutable_typed_url()->CopyFrom(new_value); 188 entity_specifics.mutable_typed_url()->CopyFrom(new_value);
189 SetEntitySpecifics(entity_specifics); 189 SetEntitySpecifics(entity_specifics);
190 } 190 }
191 191
192 void WriteNode::SetExternalId(int64_t id) { 192 void WriteNode::SetExternalId(int64_t id) {
193 if (GetExternalId() != id) 193 if (GetExternalId() != id)
194 entry_->PutLocalExternalId(id); 194 entry_->PutLocalExternalId(id);
195 } 195 }
196 196
197 WriteNode::WriteNode(WriteTransaction* transaction) 197 WriteNode::WriteNode(WriteTransaction* transaction)
198 : entry_(NULL), transaction_(transaction) { 198 : entry_(nullptr), transaction_(transaction) {
199 DCHECK(transaction); 199 DCHECK(transaction);
200 } 200 }
201 201
202 WriteNode::~WriteNode() { 202 WriteNode::~WriteNode() {
203 delete entry_; 203 delete entry_;
204 } 204 }
205 205
206 // Find an existing node matching the ID |id|, and bind this WriteNode to it. 206 // Find an existing node matching the ID |id|, and bind this WriteNode to it.
207 // Return true on success. 207 // Return true on success.
208 BaseNode::InitByLookupResult WriteNode::InitByIdLookup(int64_t id) { 208 BaseNode::InitByLookupResult WriteNode::InitByIdLookup(int64_t id) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 ModelType model_type = GetModelType(); 251 ModelType model_type = GetModelType();
252 DCHECK_EQ(model_type, NIGORI); 252 DCHECK_EQ(model_type, NIGORI);
253 return INIT_OK; 253 return INIT_OK;
254 } 254 }
255 255
256 // Create a new node with default properties, and bind this WriteNode to it. 256 // Create a new node with default properties, and bind this WriteNode to it.
257 // Return true on success. 257 // Return true on success.
258 bool WriteNode::InitBookmarkByCreation(const BaseNode& parent, 258 bool WriteNode::InitBookmarkByCreation(const BaseNode& parent,
259 const BaseNode* predecessor) { 259 const BaseNode* predecessor) {
260 DCHECK(!entry_) << "Init called twice"; 260 DCHECK(!entry_) << "Init called twice";
261 // |predecessor| must be a child of |parent| or NULL. 261 // |predecessor| must be a child of |parent| or null.
262 if (predecessor && predecessor->GetParentId() != parent.GetId()) { 262 if (predecessor && predecessor->GetParentId() != parent.GetId()) {
263 DCHECK(false); 263 DCHECK(false);
264 return false; 264 return false;
265 } 265 }
266 266
267 syncable::Id parent_id = parent.GetSyncId(); 267 syncable::Id parent_id = parent.GetSyncId();
268 DCHECK(!parent_id.IsNull()); 268 DCHECK(!parent_id.IsNull());
269 269
270 // Start out with a dummy name. We expect 270 // Start out with a dummy name. We expect
271 // the caller to set a meaningful name after creation. 271 // the caller to set a meaningful name after creation.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 398
399 // Mark this entry as unsynced, to wake up the syncer. 399 // Mark this entry as unsynced, to wake up the syncer.
400 MarkForSyncing(); 400 MarkForSyncing();
401 401
402 return INIT_SUCCESS; 402 return INIT_SUCCESS;
403 } 403 }
404 404
405 bool WriteNode::SetPosition(const BaseNode& new_parent, 405 bool WriteNode::SetPosition(const BaseNode& new_parent,
406 const BaseNode* predecessor) { 406 const BaseNode* predecessor) {
407 // |predecessor| must be a child of |new_parent| or NULL. 407 // |predecessor| must be a child of |new_parent| or null.
408 if (predecessor && predecessor->GetParentId() != new_parent.GetId()) { 408 if (predecessor && predecessor->GetParentId() != new_parent.GetId()) {
409 DCHECK(false); 409 DCHECK(false);
410 return false; 410 return false;
411 } 411 }
412 412
413 syncable::Id new_parent_id = new_parent.GetSyncId(); 413 syncable::Id new_parent_id = new_parent.GetSyncId();
414 DCHECK(!new_parent_id.IsNull()); 414 DCHECK(!new_parent_id.IsNull());
415 415
416 // Filter out redundant changes if both the parent and the predecessor match. 416 // Filter out redundant changes if both the parent and the predecessor match.
417 if (new_parent_id == entry_->GetParentId()) { 417 if (new_parent_id == entry_->GetParentId()) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 syncable::Id predecessor_id = 469 syncable::Id predecessor_id =
470 predecessor ? predecessor->GetSyncId() : syncable::Id(); 470 predecessor ? predecessor->GetSyncId() : syncable::Id();
471 return entry_->PutPredecessor(predecessor_id); 471 return entry_->PutPredecessor(predecessor_id);
472 } 472 }
473 473
474 void WriteNode::MarkForSyncing() { 474 void WriteNode::MarkForSyncing() {
475 syncable::MarkForSyncing(entry_); 475 syncable::MarkForSyncing(entry_);
476 } 476 }
477 477
478 } // namespace syncer 478 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/syncable/write_node.h ('k') | components/sync/syncable/write_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698