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

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

Issue 1877833002: Optimize shortcuts provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes after review, round 1 Created 4 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_OMNIBOX_BROWSER_SHORTCUT_MATCH_H_
6 #define COMPONENTS_OMNIBOX_BROWSER_SHORTCUT_MATCH_H_
7
8 #include <vector>
9
10 #include "base/strings/string16.h"
11 #include "components/omnibox/browser/shortcuts_backend.h"
12 #include "url/gurl.h"
13
14 // ShortcutMatch holds sufficient information about a single match from the
15 // shortcut database to allow for destination deduping and relevance sorting.
16 // After those stages the top matches are converted to the more heavyweight
17 // AutocompleteMatch struct. Avoiding constructing the larger struct for every
18 // such match can save significant time when there are many shortcut matches to
19 // process.
20 struct ShortcutMatch {
21 ShortcutMatch(int relevance,
22 const GURL& stripped_destination_url,
23 const ShortcutsDatabase::Shortcut* shortcut);
24 static bool DestinationsEqual(const ShortcutMatch& elem1,
Peter Kasting 2016/04/12 23:29:50 Nit: Since these two methods are each used just on
Alexander Yashkin 2016/04/13 09:29:36 Done, yet i had to inline this call to match_compa
25 const ShortcutMatch& elem2);
26 static bool MoreRelevant(const ShortcutMatch& elem1,
27 const ShortcutMatch& elem2);
28 int relevance;
29 GURL stripped_destination_url;
30 const ShortcutsDatabase::Shortcut* shortcut;
31 base::string16 contents;
32 AutocompleteMatch::Type type;
33 };
34
35 typedef std::vector<ShortcutMatch> ShortcutMatches;
36
37 #endif // COMPONENTS_YANDEX_OMNIBOX_BROWSER_SHORTCUT_MATCH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698