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

Side by Side Diff: chrome/browser/history/url_index_private_data.h

Issue 15645012: Omnibox: Rebuild HQP Cache if it's old (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: correct 1 to -1. Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
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
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
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
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.
340 base::Time last_time_rebuilt_from_history_;
341
338 // A list of all of indexed words. The index of a word in this list is the 342 // 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 343 // 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. 344 // replacing a potentially long and repeated string with a simple index.
341 String16Vector word_list_; 345 String16Vector word_list_;
342 346
343 // A list of available words slots in |word_list_|. An available word slot 347 // 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 348 // 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 349 // 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 350 // 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 351 // 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
385 // 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
386 // at three stages in the index searching process. 390 // at three stages in the index searching process.
387 size_t pre_filter_item_count_; // After word index is queried. 391 size_t pre_filter_item_count_; // After word index is queried.
388 size_t post_filter_item_count_; // After trimming large result set. 392 size_t post_filter_item_count_; // After trimming large result set.
389 size_t post_scoring_item_count_; // After performing final filter/scoring. 393 size_t post_scoring_item_count_; // After performing final filter/scoring.
390 }; 394 };
391 395
392 } // namespace history 396 } // namespace history
393 397
394 #endif // CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_ 398 #endif // CHROME_BROWSER_HISTORY_URL_INDEX_PRIVATE_DATA_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/in_memory_url_index_unittest.cc ('k') | chrome/browser/history/url_index_private_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698