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..3ef56eb3e95d53e84c280a8c9f67cb99f5b19c94 100644 |
| --- a/components/omnibox/browser/url_index_private_data.cc |
| +++ b/components/omnibox/browser/url_index_private_data.cc |
| @@ -397,8 +397,20 @@ 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. |
| + const int max_urls_indexed = |
| + OmniboxFieldTrial::MaxNumHQPUrlsIndexedAtStartup(); |
| + 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. |
|
sdefresne
2017/05/10 08:59:41
nit: Should this comment be "// Do not use >= to a
ssid
2017/05/10 19:47:58
Done.
|
| + if (num_urls_indexed++ == max_urls_indexed) |
| + break; |
| rebuilt_data->IndexRow( |
| history_db, nullptr, row, scheme_whitelist, nullptr); |
| } |