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..d59c2f9339e6d429ad4c71cc09e1a3f68a0935f5 100644 |
--- a/components/omnibox/browser/url_index_private_data.cc |
+++ b/components/omnibox/browser/url_index_private_data.cc |
@@ -397,8 +397,24 @@ 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(); |
+ |
+ // Limit the nuber of URLs indexed on low end devices. This would degrade the |
Mark P
2017/05/07 21:32:38
nit: would degrade -> degrades
|
+ // quality of suggestions to save memory. |
+ int max_history_urls_indexed = -1; // unlimited |
+ if (base::SysInfo::IsLowEndDevice()) { |
+ std::string limit = |
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
+ switches::kLimitHistoryUrlIndexingForOmnibox); |
+ if (!limit.empty() && !base::StringToInt(limit, &max_history_urls_indexed)) |
+ max_history_urls_indexed = -1; |
+ } |
+ |
+ int num_urls_indexed = 0; |
for (history::URLRow row; history_enum.GetNextURL(&row);) { |
+ if (++num_urls_indexed == max_history_urls_indexed) |
+ break; |
rebuilt_data->IndexRow( |
history_db, nullptr, row, scheme_whitelist, nullptr); |
} |