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

Side by Side Diff: components/bookmarks/browser/typed_count_sorter.cc

Issue 2691393002: Fix auto raw pointer deduction on linux (Closed)
Patch Set: rebase Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/bookmarks/browser/typed_count_sorter.h" 5 #include "components/bookmarks/browser/typed_count_sorter.h"
6 6
7 #include "components/bookmarks/browser/bookmark_client.h" 7 #include "components/bookmarks/browser/bookmark_client.h"
8 8
9 namespace bookmarks { 9 namespace bookmarks {
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 TypedCountSorter::~TypedCountSorter() {} 51 TypedCountSorter::~TypedCountSorter() {}
52 52
53 void TypedCountSorter::SortMatches(const TitledUrlNodeSet& matches, 53 void TypedCountSorter::SortMatches(const TitledUrlNodeSet& matches,
54 TitledUrlNodes* sorted_nodes) const { 54 TitledUrlNodes* sorted_nodes) const {
55 sorted_nodes->reserve(matches.size()); 55 sorted_nodes->reserve(matches.size());
56 if (client_->SupportsTypedCountForUrls()) { 56 if (client_->SupportsTypedCountForUrls()) {
57 UrlNodeMap url_node_map; 57 UrlNodeMap url_node_map;
58 UrlTypedCountMap url_typed_count_map; 58 UrlTypedCountMap url_typed_count_map;
59 for (auto node : matches) { 59 for (auto* node : matches) {
60 const GURL& url = node->GetTitledUrlNodeUrl(); 60 const GURL& url = node->GetTitledUrlNodeUrl();
61 url_node_map.insert(std::make_pair(&url, node)); 61 url_node_map.insert(std::make_pair(&url, node));
62 url_typed_count_map.insert(std::make_pair(&url, 0)); 62 url_typed_count_map.insert(std::make_pair(&url, 0));
63 } 63 }
64 64
65 client_->GetTypedCountForUrls(&url_typed_count_map); 65 client_->GetTypedCountForUrls(&url_typed_count_map);
66 66
67 UrlTypedCountPairs url_typed_counts; 67 UrlTypedCountPairs url_typed_counts;
68 std::copy(url_typed_count_map.begin(), 68 std::copy(url_typed_count_map.begin(),
69 url_typed_count_map.end(), 69 url_typed_count_map.end(),
70 std::back_inserter(url_typed_counts)); 70 std::back_inserter(url_typed_counts));
71 std::sort(url_typed_counts.begin(), 71 std::sort(url_typed_counts.begin(),
72 url_typed_counts.end(), 72 url_typed_counts.end(),
73 UrlTypedCountPairSortFunctor()); 73 UrlTypedCountPairSortFunctor());
74 std::transform(url_typed_counts.begin(), 74 std::transform(url_typed_counts.begin(),
75 url_typed_counts.end(), 75 url_typed_counts.end(),
76 std::back_inserter(*sorted_nodes), 76 std::back_inserter(*sorted_nodes),
77 UrlTypedCountPairNodeLookupFunctor(url_node_map)); 77 UrlTypedCountPairNodeLookupFunctor(url_node_map));
78 } else { 78 } else {
79 sorted_nodes->insert(sorted_nodes->end(), matches.begin(), matches.end()); 79 sorted_nodes->insert(sorted_nodes->end(), matches.begin(), matches.end());
80 } 80 }
81 } 81 }
82 82
83 } // namespace bookmarks 83 } // namespace bookmarks
OLDNEW
« no previous file with comments | « components/autofill/core/browser/personal_data_manager.cc ('k') | components/component_updater/component_updater_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698