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

Side by Side Diff: components/omnibox/browser/url_index_private_data.h

Issue 2333253002: flat containers prototype (Closed)
Patch Set: using flat maps/sets to optimise Created 4 years, 3 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 (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 #ifndef COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_ 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_
6 #define COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_ 6 #define COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Creates a cache item for a term which has no results. 177 // Creates a cache item for a term which has no results.
178 SearchTermCacheItem(); 178 SearchTermCacheItem();
179 SearchTermCacheItem(const SearchTermCacheItem& other); 179 SearchTermCacheItem(const SearchTermCacheItem& other);
180 180
181 ~SearchTermCacheItem(); 181 ~SearchTermCacheItem();
182 182
183 WordIDSet word_id_set_; 183 WordIDSet word_id_set_;
184 HistoryIDSet history_id_set_; 184 HistoryIDSet history_id_set_;
185 bool used_; // True if this item has been used for the current term search. 185 bool used_; // True if this item has been used for the current term search.
186 }; 186 };
187 typedef std::map<base::string16, SearchTermCacheItem> SearchTermCacheMap; 187 typedef base::flat_map<base::string16, SearchTermCacheItem>
188 SearchTermCacheMap;
188 189
189 // A helper class which performs the final filter on each candidate 190 // A helper class which performs the final filter on each candidate
190 // history URL match, inserting accepted matches into |scored_matches_|. 191 // history URL match, inserting accepted matches into |scored_matches_|.
191 class AddHistoryMatch { 192 class AddHistoryMatch {
192 public: 193 public:
193 AddHistoryMatch(bookmarks::BookmarkModel* bookmark_model, 194 AddHistoryMatch(bookmarks::BookmarkModel* bookmark_model,
194 TemplateURLService* template_url_service, 195 TemplateURLService* template_url_service,
195 const URLIndexPrivateData& private_data, 196 const URLIndexPrivateData& private_data,
196 const base::string16& lower_string, 197 const base::string16& lower_string,
197 const String16Vector& lower_terms, 198 const String16Vector& lower_terms,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 int saved_cache_version_; 388 int saved_cache_version_;
388 389
389 // Used for unit testing only. Records the number of candidate history items 390 // Used for unit testing only. Records the number of candidate history items
390 // at three stages in the index searching process. 391 // at three stages in the index searching process.
391 size_t pre_filter_item_count_; // After word index is queried. 392 size_t pre_filter_item_count_; // After word index is queried.
392 size_t post_filter_item_count_; // After trimming large result set. 393 size_t post_filter_item_count_; // After trimming large result set.
393 size_t post_scoring_item_count_; // After performing final filter/scoring. 394 size_t post_scoring_item_count_; // After performing final filter/scoring.
394 }; 395 };
395 396
396 #endif // COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_ 397 #endif // COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698