| 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 #ifndef COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_ |
| 6 #define COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // this class is for exclusive use by the InMemoryURLIndex class there should | 43 // this class is for exclusive use by the InMemoryURLIndex class there should |
| 44 // be no calls from any other class. | 44 // be no calls from any other class. |
| 45 // | 45 // |
| 46 // All public member functions are called on the main thread unless otherwise | 46 // All public member functions are called on the main thread unless otherwise |
| 47 // annotated. | 47 // annotated. |
| 48 class URLIndexPrivateData | 48 class URLIndexPrivateData |
| 49 : public base::RefCountedThreadSafe<URLIndexPrivateData> { | 49 : public base::RefCountedThreadSafe<URLIndexPrivateData> { |
| 50 public: | 50 public: |
| 51 URLIndexPrivateData(); | 51 URLIndexPrivateData(); |
| 52 | 52 |
| 53 // Given a |term_string|, scans the history index and returns a vector with | 53 // Given a base::string16 in |term_string|, scans the history index and |
| 54 // all scored, matching history items. The |term_string| is broken down into | 54 // returns a vector with all scored, matching history items. The |
| 55 // individual terms (words), each of which must occur in the candidate | 55 // |term_string| is broken down into individual terms (words), each of which |
| 56 // history item's URL or page title for the item to qualify; however, the | 56 // must occur in the candidate history item's URL or page title for the item |
| 57 // terms do not necessarily have to be adjacent. We also allow breaking | 57 // to qualify; however, the terms do not necessarily have to be adjacent. We |
| 58 // |term_string| at |cursor_position| (if set). Once we have a set of | 58 // also allow breaking |term_string| at |cursor_position| (if |
| 59 // candidates, they are filtered to ensure that all |term_string| terms, as | 59 // set). Once we have a set of candidates, they are filtered to ensure |
| 60 // separated by whitespace and the cursor (if set), occur within the | 60 // that all |term_string| terms, as separated by whitespace and the |
| 61 // candidate's URL or page title. Scores are then calculated on no more than | 61 // cursor (if set), occur within the candidate's URL or page title. |
| 62 // |kItemsToScoreLimit| candidates, as the scoring of such a large number of | 62 // Scores are then calculated on no more than |kItemsToScoreLimit| |
| 63 // candidates may cause perceptible typing response delays in the omnibox. | 63 // candidates, as the scoring of such a large number of candidates may |
| 64 // This is likely to occur for short omnibox terms such as 'h' and 'w' which | 64 // cause perceptible typing response delays in the omnibox. This is |
| 65 // likely to occur for short omnibox terms such as 'h' and 'w' which |
| 65 // will be found in nearly all history candidates. Results are sorted by | 66 // will be found in nearly all history candidates. Results are sorted by |
| 66 // descending score. The full results set (i.e. beyond the | 67 // descending score. The full results set (i.e. beyond the |
| 67 // |kItemsToScoreLimit| limit) will be retained and used for subsequent calls | 68 // |kItemsToScoreLimit| limit) will be retained and used for subsequent calls |
| 68 // to this function. In total, |max_matches| of items will be returned in the | 69 // to this function. In total, |max_matches| of items will be returned in the |
| 69 // |ScoredHistoryMatches| vector. | 70 // |ScoredHistoryMatches| vector. |
| 70 ScoredHistoryMatches HistoryItemsForTerms( | 71 ScoredHistoryMatches HistoryItemsForTerms( |
| 71 base::string16 term_string, | 72 base::string16 term_string, |
| 72 size_t cursor_position, | 73 size_t cursor_position, |
| 73 size_t max_matches, | 74 size_t max_matches, |
| 74 bookmarks::BookmarkModel* bookmark_model, | 75 bookmarks::BookmarkModel* bookmark_model, |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 int saved_cache_version_; | 387 int saved_cache_version_; |
| 387 | 388 |
| 388 // Used for unit testing only. Records the number of candidate history items | 389 // Used for unit testing only. Records the number of candidate history items |
| 389 // at three stages in the index searching process. | 390 // at three stages in the index searching process. |
| 390 size_t pre_filter_item_count_; // After word index is queried. | 391 size_t pre_filter_item_count_; // After word index is queried. |
| 391 size_t post_filter_item_count_; // After trimming large result set. | 392 size_t post_filter_item_count_; // After trimming large result set. |
| 392 size_t post_scoring_item_count_; // After performing final filter/scoring. | 393 size_t post_scoring_item_count_; // After performing final filter/scoring. |
| 393 }; | 394 }; |
| 394 | 395 |
| 395 #endif // COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_ | 396 #endif // COMPONENTS_OMNIBOX_BROWSER_URL_INDEX_PRIVATE_DATA_H_ |
| OLD | NEW |