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

Side by Side Diff: components/history/core/browser/url_database.cc

Issue 2864103003: Limit the number of history urls indexed for omnibox suggestions. (Closed)
Patch Set: Address comments. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/history/core/browser/url_database.h" 5 #include "components/history/core/browser/url_database.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 enumerator->initialized_ = enumerator->statement_.is_valid(); 241 enumerator->initialized_ = enumerator->statement_.is_valid();
242 return enumerator->statement_.is_valid(); 242 return enumerator->statement_.is_valid();
243 } 243 }
244 244
245 bool URLDatabase::InitURLEnumeratorForSignificant(URLEnumerator* enumerator) { 245 bool URLDatabase::InitURLEnumeratorForSignificant(URLEnumerator* enumerator) {
246 DCHECK(!enumerator->initialized_); 246 DCHECK(!enumerator->initialized_);
247 std::string sql("SELECT "); 247 std::string sql("SELECT ");
248 sql.append(kURLRowFields); 248 sql.append(kURLRowFields);
249 sql.append(" FROM urls WHERE last_visit_time >= ? OR visit_count >= ? OR " 249 sql.append(" FROM urls WHERE last_visit_time >= ? OR visit_count >= ? OR "
250 "typed_count >= ?"); 250 "typed_count >= ?");
251 sql.append(
252 " ORDER BY typed_count DESC, last_visit_time DESC, visit_count "
253 "DESC");
251 enumerator->statement_.Assign(GetDB().GetUniqueStatement(sql.c_str())); 254 enumerator->statement_.Assign(GetDB().GetUniqueStatement(sql.c_str()));
252 enumerator->statement_.BindInt64( 255 enumerator->statement_.BindInt64(
253 0, AutocompleteAgeThreshold().ToInternalValue()); 256 0, AutocompleteAgeThreshold().ToInternalValue());
254 enumerator->statement_.BindInt(1, kLowQualityMatchVisitLimit); 257 enumerator->statement_.BindInt(1, kLowQualityMatchVisitLimit);
255 enumerator->statement_.BindInt(2, kLowQualityMatchTypedLimit); 258 enumerator->statement_.BindInt(2, kLowQualityMatchTypedLimit);
256 enumerator->initialized_ = enumerator->statement_.is_valid(); 259 enumerator->initialized_ = enumerator->statement_.is_valid();
257 return enumerator->statement_.is_valid(); 260 return enumerator->statement_.is_valid();
258 } 261 }
259 262
260 bool URLDatabase::AutocompleteForPrefix(const std::string& prefix, 263 bool URLDatabase::AutocompleteForPrefix(const std::string& prefix,
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 bool RowQualifiesAsSignificant(const URLRow& row, 643 bool RowQualifiesAsSignificant(const URLRow& row,
641 const base::Time& threshold) { 644 const base::Time& threshold) {
642 const base::Time& real_threshold = 645 const base::Time& real_threshold =
643 threshold.is_null() ? AutocompleteAgeThreshold() : threshold; 646 threshold.is_null() ? AutocompleteAgeThreshold() : threshold;
644 return (row.typed_count() >= kLowQualityMatchTypedLimit) || 647 return (row.typed_count() >= kLowQualityMatchTypedLimit) ||
645 (row.visit_count() >= kLowQualityMatchVisitLimit) || 648 (row.visit_count() >= kLowQualityMatchVisitLimit) ||
646 (row.last_visit() >= real_threshold); 649 (row.last_visit() >= real_threshold);
647 } 650 }
648 651
649 } // namespace history 652 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/url_database.h ('k') | components/history/core/browser/url_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698