Commit 6bce7f36 authored by pkasting@chromium.org's avatar pkasting@chromium.org

Don't call AutocompleteInput::Parse() on a background thread, part 1.

Instead of creating the exact match in HistoryURLProvider::DoAutocomplete(),
pass it in in the HistoryURLProviderParams struct.

This also uses this match as the "can't find DB, fallback" match in Start(); I
don't see any disadvantage to creating that match on the results of running
fixup, instead of creating a pre-fixup match like before.

This also splits out CanPromoteMatchForInlineAutocomplete() from
PromoteMatchForInlineAutocomplete().  I'll be converting
PromoteMatchForInlineAutocomplete() into a different function in the next part
of this change, and this happens to make the calling convention a little more
sane anyway.

Also removes a few comments from the .cc file that are in the .h file already.

BUG=376199
TEST=none
R=mpearson@chromium.org

Review URL: https://codereview.chromium.org/336173005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277886 0039d316-1c4b-4281-b951-d872f2087c98
parent b7deaa08
......@@ -90,6 +90,7 @@ class URLDatabase;
struct HistoryURLProviderParams {
HistoryURLProviderParams(const AutocompleteInput& input,
bool trim_http,
const AutocompleteMatch& what_you_typed_match,
const std::string& languages,
TemplateURL* default_search_provider,
const SearchTermsData& search_terms_data);
......@@ -109,6 +110,9 @@ struct HistoryURLProviderParams {
// Set when "http://" should be trimmed from the beginning of the URLs.
bool trim_http;
// A match corresponding to what the user typed.
AutocompleteMatch what_you_typed_match;
// Set by the main thread to cancel this request. If this flag is set when
// the query runs, the query will be abandoned. This allows us to avoid
// running queries that are no longer needed. Since we don't care if we run
......@@ -221,16 +225,14 @@ class HistoryURLProvider : public HistoryProvider {
// Frees params_gets_deleted on exit.
void QueryComplete(HistoryURLProviderParams* params_gets_deleted);
// Given a |match| containing the "what you typed" suggestion created by
// SuggestExactInput(), looks up its info in the DB. If found, fills in the
// title from the DB, promotes the match's priority to that of an inline
// Looks up the info for params->what_you_typed_match in the DB. If found,
// fills in the title, promotes the match's priority to that of an inline
// autocomplete match (maybe it should be slightly better?), and places it on
// the front of |matches| (so we pick the right matches to throw away
// when culling redirects to/from it). Returns whether a match was promoted.
// the front of |matches| (so we pick the right matches to throw away when
// culling redirects to/from it). Returns whether a match was promoted.
bool FixupExactSuggestion(history::URLDatabase* db,
const AutocompleteInput& input,
const VisitClassifier& classifier,
AutocompleteMatch* match,
HistoryURLProviderParams* params,
history::HistoryMatches* matches) const;
// Helper function for FixupExactSuggestion, this returns true if the input
......@@ -239,9 +241,8 @@ class HistoryURLProvider : public HistoryProvider {
bool CanFindIntranetURL(history::URLDatabase* db,
const AutocompleteInput& input) const;
// Determines if |match| is suitable for inline autocomplete. If so, and if
// |params| is non-NULL, promotes the match. Returns whether |match| is
// suitable for inline autocomplete.
// Determines if |match| is suitable for inline autocomplete. If so, promotes
// the match. Returns whether |match| was promoted.
bool PromoteMatchForInlineAutocomplete(const history::HistoryMatch& match,
HistoryURLProviderParams* params);
......@@ -255,7 +256,6 @@ class HistoryURLProvider : public HistoryProvider {
history::URLDatabase* db,
const HistoryURLProviderParams& params,
bool have_what_you_typed_match,
const AutocompleteMatch& what_you_typed_match,
history::HistoryMatches* matches);
// Removes results that have been rarely typed or visited, and not any time
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment