-
manukh authored
Drive responses have noticeable latency. To avoid matches switching styling between drive-like (e.g. 'Title - Date - Owner - Google Docs') and non-drive-like (e.g. 'Title - URL'), the provider caches previous matches and returns them synchronously before the async matches from the backend are ready. Cached docs that no longer match the input, should not be displayed; e.g. the match 'doc x' should not be displayed for input 'doc y' even though it may be cached from the previous input 'doc '. Therefore, cached matches previously had their scores set to 0; if still relevant, they will inherit a non-0 score from a duplicate history or bookmark match; otherwise, they'll keep a score of 0 and be hidden. This had 2 problems that resulted in matches either appearing & disappearing or swapping places during the sync (on keystroke) and async (on backend response) phases: 1) There isn't always a duplicate match to inherit a score from. 2) Ranking per history/bookmark scoring could differ from the ranking per the max of the history/bookmark & document scoring. To address the above 2 issues, cached matches no longer have their scores set to 0 during the async phase. To preserve the original intent, cached matches will continue to have their scores set to 0 during the sync phase. Also groups the code controlling whether to run the document provider into |IsDocumentProviderAllowed()|, should have no effect. Also updates doc |stripped_destination_url| to use |AutocompleteMatch::GURLToStrippedGURL()| (which invokes |DocumentProvider::GetURLForDeduping()|) instead of calling the latter directly. The former resorts to a generic striped URL computation if the latter doc-specific computation doesn't succeed. This ensures a non-empty |stripped_destination_url| which avoids overriding cache entries. Change-Id: I7f8b5c4935df40c0c8a937725f4fb99d93bdd637 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2634131 Commit-Queue: manuk hovanesian <manukh@chromium.org> Reviewed-by:
Justin Donnelly <jdonnelly@chromium.org> Cr-Commit-Position: refs/heads/master@{#845704}
ec759de0