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

Issue 2717893002: Omnibox - Warm Up PSuggest on Focus (Closed)

Created:
3 years, 9 months ago by Mark P
Modified:
3 years, 9 months ago
Reviewers:
Peter Kasting
CC:
chromium-reviews, jdonnelly+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Omnibox - Warm Up PSuggest on Focus When the omnibox gains focus, have SearchProvider send a request to the suggest server (even before the user types anything). This request will trigger the suggest server to load the per-user models into memory (if appropriate and necessary). Thus, when the user actually starts typing, the models will be available to help provide personalized suggestions. Guard this behavior using a field trial. For these on-focus requests, the reply from the suggest server (if any) is ignored. Sometimes the omnibox code will cancel a request-in-progress. For example, when creating a new tab page, we send a request, but then several SearchProvider::Start() calls happen with from_omnibox_focus=false, and that leads us to cancel the request so we never receive whatever response would've come. This seems okay to me because we don't care about the reply--the important thing is that we sent the request. This warm-up request should not affect the regular behavior of the search provider. I.e., normal as-you-type logic applies. The only possible negative consequence of this code is that the throttling to prevent queries to the suggest server from happening too often still applies. (We don't send requests more often than once per 100ms.) This means that if the user focuses and immediately starts typing, we might not send a request on the first keystroke. This will affect ~2% of omnibox interactions on Windows. That is, only 2% of omnibox interactions involve focus + first keystroke is tapped within 100ms. I imagine it's less on Android. (We don't have metrics for Android.) In any case, this is small enough that I'm not inclined to worry about it / come up with a new throttling strategy in the presence of this warm-up request in order to avoid it. This code is expected to work in general. I tested it on Linux. Also, sky@ has confirmed (both via code understanding and experimentally) that the focus code is getting called the same way on Windows as on Linux. Thus, it works on Windows. I also tested it on Android. I didn't bother testing on Mac. (Even if Mac doesn't handle focus events well, Mac will change soon enough with MacViews anywhere.) It would not likely be worth the trouble to fix current Mac issues if there are any. === Testing Details === Here are the test cases I tried on Linux: 1. staring Chrome which opens a new tab page by default (which puts focus in the omnibox by default). 2. when focus is on page content (not in the omnibox!), press control-t (or similar) to create a new tab (which puts focus in the omnibox by default). 3. when focus is on the page content, clicking or pressing control-l to put the focus in the omnibox. 4. when focus is on page content (not in the omnibox!), pressing control-k to put focus in the omnibox with a "Search google.com:" chip. 5. having an omnibox edit-in-progress (possibly with some text or with empty text), switching tabs, then switching back. It doesn't work in this case: 1. having an omnibox edit-in-progress, putting focus in the page content, then pressing control-l or tapping to put focus back in the omnibox. On Android, I tested the following (on a Nexus 7): 1. on the new tab page, tap to focus the omnibox 2. on the new tab page, tap to focus the box on the page (a.k.a. the "fakebox") 3. on an arbitrary web page, tap to focus the omnibox Some other tests aren't applicable because when the omnibox loses focus on Android, it loses all edits-in-progress. There's no nothing about switching back to an omnibox or a tab with an omnibox with edits-in-progress. I didn't test a phone, though I do not expect anything different. I also did not test using an auxiliary keyboard. (When one of those is a attached, I think the omnibox gets focus by default on new tab pages. Normally it does not.) That's such a minor case that I'm not worrying about it. BUG=676075 Review-Url: https://codereview.chromium.org/2717893002 Cr-Commit-Position: refs/heads/master@{#454419} Committed: https://chromium.googlesource.com/chromium/src/+/e52518a3a6faa15b49d85a4eeb278300f4bcdaa1

Patch Set 1 #

Patch Set 2 : polish #

Patch Set 3 : better comments #

Patch Set 4 : adds field trial and test #

Patch Set 5 : rebase #

Total comments: 20

Patch Set 6 : peter's comments #

Patch Set 7 : rebase #

Patch Set 8 : rebase #

Patch Set 9 : rebase #

Patch Set 10 : guard constructor for testing #

Patch Set 11 : revert accidentally added changes #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+121 lines, -33 lines) Patch
M chrome/browser/autocomplete/search_provider_unittest.cc View 1 2 3 4 5 2 chunks +38 lines, -0 lines 0 comments Download
M components/omnibox/browser/omnibox_field_trial.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M components/omnibox/browser/omnibox_field_trial.cc View 1 2 3 4 5 6 7 8 1 chunk +8 lines, -0 lines 0 comments Download
M components/omnibox/browser/search_provider.h View 1 2 3 4 5 3 chunks +13 lines, -1 line 6 comments Download
M components/omnibox/browser/search_provider.cc View 1 2 3 4 5 9 chunks +61 lines, -32 lines 2 comments Download

Messages

Total messages: 31 (23 generated)
Mark P
Hi Peter, This is ready for review. Can you please take a look? I'm hoping ...
3 years, 9 months ago (2017-02-28 20:12:05 UTC) #7
Peter Kasting
https://codereview.chromium.org/2717893002/diff/80001/chrome/browser/autocomplete/search_provider_unittest.cc File chrome/browser/autocomplete/search_provider_unittest.cc (right): https://codereview.chromium.org/2717893002/diff/80001/chrome/browser/autocomplete/search_provider_unittest.cc#newcode3551 chrome/browser/autocomplete/search_provider_unittest.cc:3551: // Make sure the default providers suggest service was ...
3 years, 9 months ago (2017-03-01 03:00:35 UTC) #8
Mark P
Please take another look, thanks. --mark https://codereview.chromium.org/2717893002/diff/80001/chrome/browser/autocomplete/search_provider_unittest.cc File chrome/browser/autocomplete/search_provider_unittest.cc (right): https://codereview.chromium.org/2717893002/diff/80001/chrome/browser/autocomplete/search_provider_unittest.cc#newcode3551 chrome/browser/autocomplete/search_provider_unittest.cc:3551: // Make sure ...
3 years, 9 months ago (2017-03-01 20:02:33 UTC) #9
Mark P
If you lgtm this and are willing to accept additional "cleanup" in a later changelist, ...
3 years, 9 months ago (2017-03-02 05:43:52 UTC) #10
Peter Kasting
CQing for now, followup can happen in other CLs. LGTM https://codereview.chromium.org/2717893002/diff/80001/components/omnibox/browser/search_provider.cc File components/omnibox/browser/search_provider.cc (right): https://codereview.chromium.org/2717893002/diff/80001/components/omnibox/browser/search_provider.cc#newcode277 ...
3 years, 9 months ago (2017-03-02 22:50:43 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2717893002/190009
3 years, 9 months ago (2017-03-02 22:51:22 UTC) #27
commit-bot: I haz the power
Committed patchset #11 (id:190009) as https://chromium.googlesource.com/chromium/src/+/e52518a3a6faa15b49d85a4eeb278300f4bcdaa1
3 years, 9 months ago (2017-03-02 22:59:42 UTC) #30
Mark P
3 years, 9 months ago (2017-03-03 22:12:25 UTC) #31
Message was sent while issue was closed.
Doing follow-up in
https://codereview.chromium.org/2725333004/

--mark

https://codereview.chromium.org/2717893002/diff/80001/components/omnibox/brow...
File components/omnibox/browser/search_provider.cc (right):

https://codereview.chromium.org/2717893002/diff/80001/components/omnibox/brow...
components/omnibox/browser/search_provider.cc:277: // typing).
On 2017/03/02 22:50:42, Peter Kasting wrote:
> On 2017/03/01 20:02:32, Mark P wrote:
> > On 2017/03/01 03:00:35, Peter Kasting wrote:
> > > Can we have had requests in-flight before this?  Going out of focus should
> > have
> > > closed the dropdown, which should have stopped all providers, which should
> > have
> > > stopped all requests, no?
> > 
> > Probably...?
> > 
> > But there are so many edge cases.  E.g., control-l to focus, dropdown does
not
> > focus, click on web content, control-l to focus.  Do we cancel requests on
> loss
> > of focus even if the dropdown was not open?
> 
> Yes.  Otherwise, the dropdown could pop open later when the not-stopped
requests
> return results back.  So I think this is an invariant that we cannot have
> requests in flight here.
> 
> I would aim to remove this and the accompanying comment bits.

Removed it and removed comment.  Added DCHECK to verify your claim.

https://codereview.chromium.org/2717893002/diff/190009/components/omnibox/bro...
File components/omnibox/browser/search_provider.cc (right):

https://codereview.chromium.org/2717893002/diff/190009/components/omnibox/bro...
components/omnibox/browser/search_provider.cc:275: // requests here (there
likely aren't yet, though it doesn't hurt to be safe
On 2017/03/02 22:50:42, Peter Kasting wrote:
> Nit: Missing paren

Now moot.

https://codereview.chromium.org/2717893002/diff/190009/components/omnibox/bro...
File components/omnibox/browser/search_provider.h (right):

https://codereview.chromium.org/2717893002/diff/190009/components/omnibox/bro...
components/omnibox/browser/search_provider.h:199: // Check constraints that may
be violated by suggested relevances and revises/
On 2017/03/02 22:50:42, Peter Kasting wrote:
> Nit: Check -> Checks

Done.

https://codereview.chromium.org/2717893002/diff/190009/components/omnibox/bro...
components/omnibox/browser/search_provider.h:200: // rolls back the suggested
relevance scores to make all constraints old.
On 2017/03/02 22:50:42, Peter Kasting wrote:
> Nit: old -> hold

Done.

https://codereview.chromium.org/2717893002/diff/190009/components/omnibox/bro...
components/omnibox/browser/search_provider.h:203: // Record the top suggestion
(if any) for future use.  SearchProvider tries
On 2017/03/02 22:50:42, Peter Kasting wrote:
> Nit: Record -> Records

Done.

Powered by Google App Engine
This is Rietveld 408576698