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

Issue 2846733004: Optimization: not sending answer server requests for voice queries. (Closed)

Created:
3 years, 7 months ago by vadimt
Modified:
3 years, 7 months ago
Reviewers:
xiyuan
CC:
chromium-reviews, tfarina, Matt Giuca
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Optimization: not sending answer server requests for voice queries. This is because launcher closes after voice queries. Also fixing a bug where a voice query was treated as a non-voice query for some short period of time. This happened because while "is voice query" flag was cleared, the query text remained non-empty. This caused, in particular, unnecessary answer server queries after the voice query is over. Stack example (with "is voice" already cleared, and query text is still non-empty): 0 app_list::SearchAnswerWebContentsDelegate::Update (this=0x48a03b686e0, is_voice_query=<optimized out>) at ../../chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc:93 1 0x000064441d08df8a in AppListViewDelegate::OnTemplateURLServiceChanged (this=0x48a046fa000) at ../../chrome/browser/ui/app_list/app_list_view_delegate.cc:534 2 0x000064441c687230 in TemplateURLService::NotifyObservers (this=<optimized out>) at ../../components/search_engines/template_url_service.cc:2124 3 0x000064441c68ec06 in Update (this=0x48a0265a340, existing_turl=0x48a0350d600, new_values=...) at ../../components/search_engines/template_url_service.cc:1713 4 TemplateURLService::UpdateTemplateURLVisitTime (this=0x48a0265a340, url=0x48a0350d600) at ../../components/search_engines/template_url_service.cc:1787 5 0x000064441c689375 in TemplateURLService::UpdateKeywordSearchTermsForURL (this=0x48a0265a340, details=...) at ../../components/search_engines/template_url_service.cc:1781 6 0x000064441af6bb4f in non-virtual thunk to ChromeTemplateURLServiceClient::OnURLVisited(history::HistoryService*, ui::PageTransition, history::URLRow const&, std::vector<GURL, std::allocator<GURL> > const&, base::Time) () at ../../chrome/browser/search_engines/chrome_template_url_service_client.cc:85 7 0x000064441c62bf32 in history::HistoryService::NotifyURLVisited (this=0x48a027df500, transition=805306373, row=..., redirects=std::vector of length 0, capacity 0, visit_time=...) at ../../components/history/core/browser/history_service.cc:1092 ...... Some frames may be optimized away due to inlining. Also other optimizations and cleanups; as a result, we now have exactly as many expensive requests (such as server queries) as necessary. Bug=712331 Review-Url: https://codereview.chromium.org/2846733004 Cr-Commit-Position: refs/heads/master@{#468469} Committed: https://chromium.googlesource.com/chromium/src/+/9815502de37719154e0e2f2bc8ad4caa7b5561fd

Patch Set 1 #

Total comments: 4

Patch Set 2 : Moved voice flag to search box model. #

Patch Set 3 : Fixing test compile error #

Patch Set 4 : Fixing broken tests. #

Total comments: 6

Patch Set 5 : Last nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+54 lines, -36 lines) Patch
M chrome/browser/ui/app_list/app_list_controller_browsertest.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/app_list/app_list_view_delegate.h View 1 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/ui/app_list/app_list_view_delegate.cc View 1 2 3 4 7 chunks +6 lines, -13 lines 0 comments Download
M chrome/browser/ui/app_list/search_answer_web_contents_delegate.h View 1 2 3 4 3 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc View 1 2 3 4 3 chunks +16 lines, -1 line 0 comments Download
M ui/app_list/app_list_model.cc View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M ui/app_list/search_box_model.h View 1 2 3 4 2 chunks +5 lines, -2 lines 0 comments Download
M ui/app_list/search_box_model.cc View 1 2 3 4 3 chunks +5 lines, -5 lines 0 comments Download
M ui/app_list/search_box_model_observer.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M ui/app_list/search_controller.h View 1 1 chunk +1 line, -1 line 0 comments Download
M ui/app_list/search_controller.cc View 1 1 chunk +4 lines, -4 lines 0 comments Download
M ui/app_list/views/app_list_main_view.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M ui/app_list/views/search_box_view.h View 1 1 chunk +1 line, -1 line 0 comments Download
M ui/app_list/views/search_box_view.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 27 (18 generated)
vadimt
3 years, 7 months ago (2017-04-27 21:39:42 UTC) #2
xiyuan
https://codereview.chromium.org/2846733004/diff/1/chrome/browser/ui/app_list/app_list_view_delegate.cc File chrome/browser/ui/app_list/app_list_view_delegate.cc (right): https://codereview.chromium.org/2846733004/diff/1/chrome/browser/ui/app_list/app_list_view_delegate.cc#newcode300 chrome/browser/ui/app_list/app_list_view_delegate.cc:300: model_->search_box()->SetText(base::string16()); Is this necessary? This would trigger another StartSearch ...
3 years, 7 months ago (2017-04-27 21:59:31 UTC) #3
vadimt
https://codereview.chromium.org/2846733004/diff/1/chrome/browser/ui/app_list/app_list_view_delegate.cc File chrome/browser/ui/app_list/app_list_view_delegate.cc (right): https://codereview.chromium.org/2846733004/diff/1/chrome/browser/ui/app_list/app_list_view_delegate.cc#newcode300 chrome/browser/ui/app_list/app_list_view_delegate.cc:300: model_->search_box()->SetText(base::string16()); This is a fundamentally correct thing to do. ...
3 years, 7 months ago (2017-04-27 22:14:37 UTC) #4
xiyuan
https://codereview.chromium.org/2846733004/diff/1/chrome/browser/ui/app_list/app_list_view_delegate.cc File chrome/browser/ui/app_list/app_list_view_delegate.cc (right): https://codereview.chromium.org/2846733004/diff/1/chrome/browser/ui/app_list/app_list_view_delegate.cc#newcode300 chrome/browser/ui/app_list/app_list_view_delegate.cc:300: model_->search_box()->SetText(base::string16()); On 2017/04/27 22:14:37, vadimt wrote: > This is ...
3 years, 7 months ago (2017-04-27 22:29:20 UTC) #5
vadimt
https://codereview.chromium.org/2846733004/diff/1/chrome/browser/ui/app_list/app_list_view_delegate.cc File chrome/browser/ui/app_list/app_list_view_delegate.cc (right): https://codereview.chromium.org/2846733004/diff/1/chrome/browser/ui/app_list/app_list_view_delegate.cc#newcode300 chrome/browser/ui/app_list/app_list_view_delegate.cc:300: model_->search_box()->SetText(base::string16()); Done. Moved is_voice_query_ from AppListViewDelegate to SearchBoxModel. Switched ...
3 years, 7 months ago (2017-04-29 00:48:28 UTC) #6
xiyuan
lgtm Cool. https://codereview.chromium.org/2846733004/diff/60001/chrome/browser/ui/app_list/app_list_view_delegate.cc File chrome/browser/ui/app_list/app_list_view_delegate.cc (right): https://codereview.chromium.org/2846733004/diff/60001/chrome/browser/ui/app_list/app_list_view_delegate.cc#newcode523 chrome/browser/ui/app_list/app_list_view_delegate.cc:523: bool is_google = nit: const , since ...
3 years, 7 months ago (2017-05-01 21:16:31 UTC) #19
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/2846733004/80001
3 years, 7 months ago (2017-05-01 22:07:52 UTC) #23
commit-bot: I haz the power
Committed patchset #5 (id:80001) as https://chromium.googlesource.com/chromium/src/+/9815502de37719154e0e2f2bc8ad4caa7b5561fd
3 years, 7 months ago (2017-05-01 22:56:06 UTC) #26
vadimt
3 years, 7 months ago (2017-05-10 22:55:49 UTC) #27
Message was sent while issue was closed.
https://codereview.chromium.org/2846733004/diff/60001/chrome/browser/ui/app_l...
File chrome/browser/ui/app_list/app_list_view_delegate.cc (right):

https://codereview.chromium.org/2846733004/diff/60001/chrome/browser/ui/app_l...
chrome/browser/ui/app_list/app_list_view_delegate.cc:523: bool is_google =
On 2017/05/01 21:16:31, xiyuan wrote:
> nit: const , since you are here... :)

Done.

https://codereview.chromium.org/2846733004/diff/60001/chrome/browser/ui/app_l...
chrome/browser/ui/app_list/app_list_view_delegate.cc:528: if
(model_->search_engine_is_google() != is_google) {
On 2017/05/01 21:16:31, xiyuan wrote:
> nit: Move this test to AppListModel::SetSearchEngineIsGoogle and maybe make
> SearchAnswerWebContentsDelegate an AppListModelObserver ?

Done.

https://codereview.chromium.org/2846733004/diff/60001/ui/app_list/search_box_...
File ui/app_list/search_box_model.cc (right):

https://codereview.chromium.org/2846733004/diff/60001/ui/app_list/search_box_...
ui/app_list/search_box_model.cc:30: SearchBoxModel::SearchBoxModel() :
is_voice_query_(false) {}
Done; keep forgetting!

Powered by Google App Engine
This is Rietveld 408576698