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

Side by Side Diff: components/sync_bookmarks/bookmark_model_associator.cc

Issue 2461463002: [Sync] Replacing NULL with nullptr/null throughout sync code. (Closed)
Patch Set: Reverted PROFILE_nullptr mistake. Created 4 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_bookmarks/bookmark_model_associator.h" 5 #include "components/sync_bookmarks/bookmark_model_associator.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 const int kTitleLimitBytes = 255; 67 const int kTitleLimitBytes = 255;
68 68
69 // Provides the following abstraction: given a parent bookmark node, find best 69 // Provides the following abstraction: given a parent bookmark node, find best
70 // matching child node for many sync nodes. 70 // matching child node for many sync nodes.
71 class BookmarkNodeFinder { 71 class BookmarkNodeFinder {
72 public: 72 public:
73 // Creates an instance with the given parent bookmark node. 73 // Creates an instance with the given parent bookmark node.
74 explicit BookmarkNodeFinder(const BookmarkNode* parent_node); 74 explicit BookmarkNodeFinder(const BookmarkNode* parent_node);
75 75
76 // Finds the bookmark node that matches the given url, title and folder 76 // Finds the bookmark node that matches the given url, title and folder
77 // attribute. Returns the matching node if one exists; NULL otherwise. 77 // attribute. Returns the matching node if one exists; null otherwise.
78 // If there are multiple matches then a node with ID matching |preferred_id| 78 // If there are multiple matches then a node with ID matching |preferred_id|
79 // is returned; otherwise the first matching node is returned. 79 // is returned; otherwise the first matching node is returned.
80 // If a matching node is found, it's removed for further matches. 80 // If a matching node is found, it's removed for further matches.
81 const BookmarkNode* FindBookmarkNode(const GURL& url, 81 const BookmarkNode* FindBookmarkNode(const GURL& url,
82 const std::string& title, 82 const std::string& title,
83 bool is_folder, 83 bool is_folder,
84 int64_t preferred_id); 84 int64_t preferred_id);
85 85
86 // Returns true if |bookmark_node| matches the specified |url|, 86 // Returns true if |bookmark_node| matches the specified |url|,
87 // |title|, and |is_folder| flags. 87 // |title|, and |is_folder| flags.
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 } 333 }
334 334
335 int64_t BookmarkModelAssociator::GetSyncIdFromChromeId(const int64_t& node_id) { 335 int64_t BookmarkModelAssociator::GetSyncIdFromChromeId(const int64_t& node_id) {
336 BookmarkIdToSyncIdMap::const_iterator iter = id_map_.find(node_id); 336 BookmarkIdToSyncIdMap::const_iterator iter = id_map_.find(node_id);
337 return iter == id_map_.end() ? syncer::kInvalidId : iter->second; 337 return iter == id_map_.end() ? syncer::kInvalidId : iter->second;
338 } 338 }
339 339
340 const BookmarkNode* BookmarkModelAssociator::GetChromeNodeFromSyncId( 340 const BookmarkNode* BookmarkModelAssociator::GetChromeNodeFromSyncId(
341 int64_t sync_id) { 341 int64_t sync_id) {
342 SyncIdToBookmarkNodeMap::const_iterator iter = id_map_inverse_.find(sync_id); 342 SyncIdToBookmarkNodeMap::const_iterator iter = id_map_inverse_.find(sync_id);
343 return iter == id_map_inverse_.end() ? NULL : iter->second; 343 return iter == id_map_inverse_.end() ? nullptr : iter->second;
344 } 344 }
345 345
346 bool BookmarkModelAssociator::InitSyncNodeFromChromeId( 346 bool BookmarkModelAssociator::InitSyncNodeFromChromeId(
347 const int64_t& node_id, 347 const int64_t& node_id,
348 syncer::BaseNode* sync_node) { 348 syncer::BaseNode* sync_node) {
349 DCHECK(sync_node); 349 DCHECK(sync_node);
350 int64_t sync_id = GetSyncIdFromChromeId(node_id); 350 int64_t sync_id = GetSyncIdFromChromeId(node_id);
351 if (sync_id == syncer::kInvalidId) 351 if (sync_id == syncer::kInvalidId)
352 return false; 352 return false;
353 if (sync_node->InitByIdLookup(sync_id) != syncer::BaseNode::INIT_OK) 353 if (sync_node->InitByIdLookup(sync_id) != syncer::BaseNode::INIT_OK)
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 syncer::BOOKMARKS); 1007 syncer::BOOKMARKS);
1008 } else { 1008 } else {
1009 context->set_native_model_sync_state(BEHIND); 1009 context->set_native_model_sync_state(BEHIND);
1010 } 1010 }
1011 } 1011 }
1012 } 1012 }
1013 return syncer::SyncError(); 1013 return syncer::SyncError();
1014 } 1014 }
1015 1015
1016 } // namespace sync_bookmarks 1016 } // namespace sync_bookmarks
OLDNEW
« no previous file with comments | « components/sync_bookmarks/bookmark_model_associator.h ('k') | components/sync_sessions/favicon_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698