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 #ifndef CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ |
| 6 #define CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ | 6 #define CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 | 27 |
| 28 namespace history { | 28 namespace history { |
| 29 | 29 |
| 30 namespace imui = in_memory_url_index; | 30 namespace imui = in_memory_url_index; |
| 31 | 31 |
| 32 class HistoryDatabase; | 32 class HistoryDatabase; |
| 33 class InMemoryURLIndex; | 33 class InMemoryURLIndex; |
| 34 class RefCountedBool; | 34 class RefCountedBool; |
| 35 | 35 |
| 36 // Current version of the cache file. | 36 // Current version of the cache file. |
| 37 static const int kCurrentCacheFileVersion = 2; | 37 static const int kCurrentCacheFileVersion = 3; |
| 38 | 38 |
| 39 // A structure private to InMemoryURLIndex describing its internal data and | 39 // A structure private to InMemoryURLIndex describing its internal data and |
| 40 // providing for restoring, rebuilding and updating that internal data. As | 40 // providing for restoring, rebuilding and updating that internal data. As |
| 41 // this class is for exclusive use by the InMemoryURLIndex class there should | 41 // this class is for exclusive use by the InMemoryURLIndex class there should |
| 42 // be no calls from any other class. | 42 // be no calls from any other class. |
| 43 // | 43 // |
| 44 // All public member functions are called on the main thread unless otherwise | 44 // All public member functions are called on the main thread unless otherwise |
| 45 // annotated. | 45 // annotated. |
| 46 class URLIndexPrivateData | 46 class URLIndexPrivateData |
| 47 : public base::RefCountedThreadSafe<URLIndexPrivateData> { | 47 : public base::RefCountedThreadSafe<URLIndexPrivateData> { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 private: | 146 private: |
| 147 friend class base::RefCountedThreadSafe<URLIndexPrivateData>; | 147 friend class base::RefCountedThreadSafe<URLIndexPrivateData>; |
| 148 ~URLIndexPrivateData(); | 148 ~URLIndexPrivateData(); |
| 149 | 149 |
| 150 friend class AddHistoryMatch; | 150 friend class AddHistoryMatch; |
| 151 friend class ::HistoryQuickProviderTest; | 151 friend class ::HistoryQuickProviderTest; |
| 152 friend class InMemoryURLIndexTest; | 152 friend class InMemoryURLIndexTest; |
| 153 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, CacheSaveRestore); | 153 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, CacheSaveRestore); |
| 154 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, HugeResultSet); | 154 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, HugeResultSet); |
| 155 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, ReadVisitsFromHistory); | 155 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, ReadVisitsFromHistory); |
| 156 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, RebuildFromHistoryIfCacheOld); | |
| 156 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, Scoring); | 157 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, Scoring); |
| 157 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, TitleSearch); | 158 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, TitleSearch); |
| 158 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, TypedCharacterCaching); | 159 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, TypedCharacterCaching); |
| 159 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, WhitelistedURLs); | 160 FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, WhitelistedURLs); |
| 160 FRIEND_TEST_ALL_PREFIXES(LimitedInMemoryURLIndexTest, Initialization); | 161 FRIEND_TEST_ALL_PREFIXES(LimitedInMemoryURLIndexTest, Initialization); |
| 161 | 162 |
| 162 // Support caching of term results so that we can optimize searches which | 163 // Support caching of term results so that we can optimize searches which |
| 163 // build upon a previous search. Each entry in this map represents one | 164 // build upon a previous search. Each entry in this map represents one |
| 164 // search term from the most recent search. For example, if the user had | 165 // search term from the most recent search. For example, if the user had |
| 165 // typed "google blog trans" and then typed an additional 'l' (at the end, | 166 // typed "google blog trans" and then typed an additional 'l' (at the end, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 // Allows canceling pending requests to update recent visits information. | 329 // Allows canceling pending requests to update recent visits information. |
| 329 CancelableRequestConsumer recent_visits_consumer_; | 330 CancelableRequestConsumer recent_visits_consumer_; |
| 330 | 331 |
| 331 // Start of data members that are cached ------------------------------------- | 332 // Start of data members that are cached ------------------------------------- |
| 332 | 333 |
| 333 // The version of the cache file most recently used to restore this instance | 334 // The version of the cache file most recently used to restore this instance |
| 334 // of the private data. If the private data was rebuilt from the history | 335 // of the private data. If the private data was rebuilt from the history |
| 335 // database this will be 0. | 336 // database this will be 0. |
| 336 int restored_cache_version_; | 337 int restored_cache_version_; |
| 337 | 338 |
| 339 // The last time the data was rebuilt from the history database. If this | |
| 340 // instance was built from history right now, this time will be about Now(). | |
|
Peter Kasting
2013/06/07 00:39:55
This last sentence seems unnecessary.
Mark P
2013/06/07 00:50:27
Okay. Dropped.
| |
| 341 base::Time last_time_rebuilt_from_history_; | |
| 342 | |
| 338 // A list of all of indexed words. The index of a word in this list is the | 343 // A list of all of indexed words. The index of a word in this list is the |
| 339 // ID of the word in the word_map_. It reduces the memory overhead by | 344 // ID of the word in the word_map_. It reduces the memory overhead by |
| 340 // replacing a potentially long and repeated string with a simple index. | 345 // replacing a potentially long and repeated string with a simple index. |
| 341 String16Vector word_list_; | 346 String16Vector word_list_; |
| 342 | 347 |
| 343 // A list of available words slots in |word_list_|. An available word slot | 348 // A list of available words slots in |word_list_|. An available word slot |
| 344 // is the index of a unused word in word_list_ vector, also referred to as | 349 // is the index of a unused word in word_list_ vector, also referred to as |
| 345 // a WordID. As URL visits are added or modified new words may be added to | 350 // a WordID. As URL visits are added or modified new words may be added to |
| 346 // the index, in which case any available words are used, if any, and then | 351 // the index, in which case any available words are used, if any, and then |
| 347 // words are added to the end of the word_list_. When URL visits are | 352 // words are added to the end of the word_list_. When URL visits are |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 // Used for unit testing only. Records the number of candidate history items | 390 // Used for unit testing only. Records the number of candidate history items |
| 386 // at three stages in the index searching process. | 391 // at three stages in the index searching process. |
| 387 size_t pre_filter_item_count_; // After word index is queried. | 392 size_t pre_filter_item_count_; // After word index is queried. |
| 388 size_t post_filter_item_count_; // After trimming large result set. | 393 size_t post_filter_item_count_; // After trimming large result set. |
| 389 size_t post_scoring_item_count_; // After performing final filter/scoring. | 394 size_t post_scoring_item_count_; // After performing final filter/scoring. |
| 390 }; | 395 }; |
| 391 | 396 |
| 392 } // namespace history | 397 } // namespace history |
| 393 | 398 |
| 394 #endif // CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ | 399 #endif // CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ |
| OLD | NEW |