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

Unified Diff: components/omnibox/browser/url_index_private_data.cc

Issue 2864103003: Limit the number of history urls indexed for omnibox suggestions. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/omnibox/browser/omnibox_switches.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « components/omnibox/browser/omnibox_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698