Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/omnibox/browser/url_index_private_data.h" | 5 #include "components/omnibox/browser/url_index_private_data.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <functional> | 9 #include <functional> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 if (!history_db) | 390 if (!history_db) |
| 391 return nullptr; | 391 return nullptr; |
| 392 | 392 |
| 393 base::TimeTicks beginning_time = base::TimeTicks::Now(); | 393 base::TimeTicks beginning_time = base::TimeTicks::Now(); |
| 394 | 394 |
| 395 scoped_refptr<URLIndexPrivateData> | 395 scoped_refptr<URLIndexPrivateData> |
| 396 rebuilt_data(new URLIndexPrivateData); | 396 rebuilt_data(new URLIndexPrivateData); |
| 397 history::URLDatabase::URLEnumerator history_enum; | 397 history::URLDatabase::URLEnumerator history_enum; |
| 398 if (!history_db->InitURLEnumeratorForSignificant(&history_enum)) | 398 if (!history_db->InitURLEnumeratorForSignificant(&history_enum)) |
| 399 return nullptr; | 399 return nullptr; |
| 400 | |
| 400 rebuilt_data->last_time_rebuilt_from_history_ = base::Time::Now(); | 401 rebuilt_data->last_time_rebuilt_from_history_ = base::Time::Now(); |
| 402 | |
| 403 // Limiting the number of URLs indexed degrades the quality of suggestions to | |
| 404 // save memory. This limit is only applied for urls indexed at startup and | |
| 405 // more urls can be indexed during the browsing session. The primary use case | |
| 406 // is for Android devices where the session is typically short. | |
| 407 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
| |
| 408 int num_urls_indexed = 0; | |
| 401 for (history::URLRow row; history_enum.GetNextURL(&row);) { | 409 for (history::URLRow row; history_enum.GetNextURL(&row);) { |
| 410 // Do not use <= to account for case of -1 for unlimited urls. | |
| 411 if (num_urls_indexed++ == max_urls_indexed) | |
| 412 break; | |
| 402 rebuilt_data->IndexRow( | 413 rebuilt_data->IndexRow( |
| 403 history_db, nullptr, row, scheme_whitelist, nullptr); | 414 history_db, nullptr, row, scheme_whitelist, nullptr); |
| 404 } | 415 } |
| 405 | 416 |
| 406 UMA_HISTOGRAM_TIMES("History.InMemoryURLIndexingTime", | 417 UMA_HISTOGRAM_TIMES("History.InMemoryURLIndexingTime", |
| 407 base::TimeTicks::Now() - beginning_time); | 418 base::TimeTicks::Now() - beginning_time); |
| 408 UMA_HISTOGRAM_COUNTS("History.InMemoryURLHistoryItems", | 419 UMA_HISTOGRAM_COUNTS("History.InMemoryURLHistoryItems", |
| 409 rebuilt_data->history_id_word_map_.size()); | 420 rebuilt_data->history_id_word_map_.size()); |
| 410 UMA_HISTOGRAM_COUNTS_10000("History.InMemoryURLWords", | 421 UMA_HISTOGRAM_COUNTS_10000("History.InMemoryURLWords", |
| 411 rebuilt_data->word_map_.size()); | 422 rebuilt_data->word_map_.size()); |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1266 // First cut: typed count, visit count, recency. | 1277 // First cut: typed count, visit count, recency. |
| 1267 // TODO(mrossetti): This is too simplistic. Consider an approach which ranks | 1278 // TODO(mrossetti): This is too simplistic. Consider an approach which ranks |
| 1268 // recently visited (within the last 12/24 hours) as highly important. Get | 1279 // recently visited (within the last 12/24 hours) as highly important. Get |
| 1269 // input from mpearson. | 1280 // input from mpearson. |
| 1270 if (r1.typed_count() != r2.typed_count()) | 1281 if (r1.typed_count() != r2.typed_count()) |
| 1271 return (r1.typed_count() > r2.typed_count()); | 1282 return (r1.typed_count() > r2.typed_count()); |
| 1272 if (r1.visit_count() != r2.visit_count()) | 1283 if (r1.visit_count() != r2.visit_count()) |
| 1273 return (r1.visit_count() > r2.visit_count()); | 1284 return (r1.visit_count() > r2.visit_count()); |
| 1274 return (r1.last_visit() > r2.last_visit()); | 1285 return (r1.last_visit() > r2.last_visit()); |
| 1275 } | 1286 } |
| OLD | NEW |