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

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

Issue 2743713005: [sync] use std::multimap for BookmarkNodeMap (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // |title|, and |is_folder| flags. 87 // |title|, and |is_folder| flags.
88 static bool NodeMatches(const BookmarkNode* bookmark_node, 88 static bool NodeMatches(const BookmarkNode* bookmark_node,
89 const GURL& url, 89 const GURL& url,
90 const std::string& title, 90 const std::string& title,
91 bool is_folder); 91 bool is_folder);
92 92
93 private: 93 private:
94 // Maps bookmark node titles to instances, duplicates allowed. 94 // Maps bookmark node titles to instances, duplicates allowed.
95 // Titles are converted to the sync internal format before 95 // Titles are converted to the sync internal format before
96 // being used as keys for the map. 96 // being used as keys for the map.
97 using BookmarkNodeMap = base::hash_multimap<std::string, const BookmarkNode*>; 97 using BookmarkNodeMap = std::multimap<std::string, const BookmarkNode*>;
98 using BookmarkNodeRange = 98 using BookmarkNodeRange =
99 std::pair<BookmarkNodeMap::iterator, BookmarkNodeMap::iterator>; 99 std::pair<BookmarkNodeMap::iterator, BookmarkNodeMap::iterator>;
100 100
101 // Converts and truncates bookmark titles in the form sync does internally 101 // Converts and truncates bookmark titles in the form sync does internally
102 // to avoid mismatches due to sync munging titles. 102 // to avoid mismatches due to sync munging titles.
103 static void ConvertTitleToSyncInternalFormat(const std::string& input, 103 static void ConvertTitleToSyncInternalFormat(const std::string& input,
104 std::string* output); 104 std::string* output);
105 105
106 const BookmarkNode* parent_node_; 106 const BookmarkNode* parent_node_;
107 BookmarkNodeMap child_nodes_; 107 BookmarkNodeMap child_nodes_;
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 syncer::BOOKMARKS); 1003 syncer::BOOKMARKS);
1004 } else { 1004 } else {
1005 context->set_native_model_sync_state(BEHIND); 1005 context->set_native_model_sync_state(BEHIND);
1006 } 1006 }
1007 } 1007 }
1008 } 1008 }
1009 return syncer::SyncError(); 1009 return syncer::SyncError();
1010 } 1010 }
1011 1011
1012 } // namespace sync_bookmarks 1012 } // namespace sync_bookmarks
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698