Chromium Code Reviews| Index: components/omnibox/browser/url_index_private_data.cc |
| diff --git a/components/omnibox/browser/url_index_private_data.cc b/components/omnibox/browser/url_index_private_data.cc |
| index b9f2a93ea945bc2e73e33afdb396d0bd0ef8a975..d25ff9bb6feceec8ff2e4473dc17d2b66c53201b 100644 |
| --- a/components/omnibox/browser/url_index_private_data.cc |
| +++ b/components/omnibox/browser/url_index_private_data.cc |
| @@ -397,8 +397,19 @@ scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RebuildFromHistory( |
| history::URLDatabase::URLEnumerator history_enum; |
| if (!history_db->InitURLEnumeratorForSignificant(&history_enum)) |
| return nullptr; |
| + |
| rebuilt_data->last_time_rebuilt_from_history_ = base::Time::Now(); |
| + |
| + // Limiting the number of URLs indexed degrades the quality of suggestions to |
| + // save memory. This limit is only applied for urls indexed at startup and |
| + // more urls can be indexed during the browsing session. The primary use case |
| + // is for Android devices where the session is typically short. |
| + int max_urls_indexed = OmniboxFieldTrial::MaxNumHistoryUrlsIndexedAtStartup(); |
|
Mark P
2017/05/08 22:39:17
nit: const
Mark P
2017/05/08 22:39:17
I don't think our field trial config can make an e
ssid
2017/05/10 01:01:35
Done.
ssid
2017/05/10 01:01:35
I was thinking Lets first experiment for all devic
Mark P
2017/05/10 17:23:09
I'm reluctant. We recently had discussions and co
ssid
2017/05/10 19:47:58
Okay I am only looking to fix the very high number
|
| + int num_urls_indexed = 0; |
| for (history::URLRow row; history_enum.GetNextURL(&row);) { |
| + // Do not use <= to account for case of -1 for unlimited urls. |
| + if (num_urls_indexed++ == max_urls_indexed) |
| + break; |
| rebuilt_data->IndexRow( |
| history_db, nullptr, row, scheme_whitelist, nullptr); |
| } |