Commit c6e998a2 authored by tby's avatar tby Committed by Commit Bot

Speculative fix for launcher search race condition.

There's a flaky DCHECK crash in launcher search, due to the query
getting out of sync in the ranker vs the returned search results.

This is caused by deeper problems, but this CL is a quick patch
that should fix the immediate issue. Currently we don't update the
most recent query if two searches happen in quick succession, even if
the second search contains a genuinely new query. Let's fix that.

Bug: 1109017
Change-Id: Iac78aef0dae6d4001fc0726ac0deb5ced9bd11aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2319949Reviewed-by: default avatarJia Meng <jiameng@chromium.org>
Commit-Queue: Tony Yeoman <tby@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792118}
parent 083f5b4b
...@@ -220,6 +220,8 @@ void SearchResultRanker::InitializeRankers( ...@@ -220,6 +220,8 @@ void SearchResultRanker::InitializeRankers(
} }
void SearchResultRanker::FetchRankings(const base::string16& query) { void SearchResultRanker::FetchRankings(const base::string16& query) {
last_query_ = query;
// The search controller potentially calls SearchController::FetchResults // The search controller potentially calls SearchController::FetchResults
// several times for each user's search, so we cache the results of querying // several times for each user's search, so we cache the results of querying
// the models for a short time, to prevent unecessary queries. // the models for a short time, to prevent unecessary queries.
...@@ -227,7 +229,6 @@ void SearchResultRanker::FetchRankings(const base::string16& query) { ...@@ -227,7 +229,6 @@ void SearchResultRanker::FetchRankings(const base::string16& query) {
if (now - time_of_last_fetch_ < kMinSecondsBetweenFetches) if (now - time_of_last_fetch_ < kMinSecondsBetweenFetches)
return; return;
time_of_last_fetch_ = now; time_of_last_fetch_ = now;
last_query_ = query;
if (query.empty() && zero_state_group_ranker_) { if (query.empty() && zero_state_group_ranker_) {
zero_state_group_ranks_.clear(); zero_state_group_ranks_.clear();
......
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