Index: chrome/browser/history/url_index_private_data.h |
=================================================================== |
--- chrome/browser/history/url_index_private_data.h (revision 117518) |
+++ chrome/browser/history/url_index_private_data.h (working copy) |
@@ -11,6 +11,8 @@ |
#include "chrome/browser/history/in_memory_url_index_types.h" |
#include "chrome/browser/history/in_memory_url_index_cache.pb.h" |
+class InMemoryURLIndexTest; |
+ |
namespace in_memory_url_index { |
class InMemoryURLIndexCacheItem; |
} |
@@ -27,8 +29,9 @@ |
~URLIndexPrivateData(); |
private: |
+ friend class AddHistoryMatch; |
+ friend class HistoryQuickProviderTest; |
friend class InMemoryURLIndex; |
- friend class AddHistoryMatch; |
friend class InMemoryURLIndexTest; |
FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, CacheSaveRestore); |
FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, HugeResultSet); |
@@ -38,6 +41,10 @@ |
FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, WhitelistedURLs); |
FRIEND_TEST_ALL_PREFIXES(LimitedInMemoryURLIndexTest, Initialization); |
+#if 1 |
+void DUMP() const; |
+#endif |
Peter Kasting
2012/01/14 00:12:49
This seems like it should have disappeared before
mrossetti
2012/03/03 05:05:56
Done.
|
+ |
// Support caching of term results so that we can optimize searches which |
// build upon a previous search. Each entry in this map represents one |
// search term from the most recent search. For example, if the user had |
@@ -124,17 +131,20 @@ |
// down into words and each word is broken down into characters. |
void set_languages(const std::string& languages) { languages_ = languages; } |
- // Restores the index's private data from the cache file stored in the |
- // profile directory and returns true if successful. |
- bool RestoreFromFile(const FilePath& file_path); |
+ // Constructs a new object by restoring its contents from the file at |path|. |
+ // Returns the new URLIndexPrivateData which on success will contain the |
+ // restored data but upon failure will be empty. |
+ static URLIndexPrivateData* RestoreFromFile(const FilePath& path); |
+ // Constructs a new object by rebuilding its contents from the history |
+ // database in |db|. Returns the new URLIndexPrivateData which on success |
+ // will contain the rebuilt data but upon failure will be empty. |
+ static URLIndexPrivateData* RebuildFromHistory(URLDatabase* history_db); |
+ |
// Caches the index private data and writes the cache file to the profile |
// directory. |
bool SaveToFile(const FilePath& file_path); |
- // Reloads the history index from |history_db|. |
- bool ReloadFromHistory(URLDatabase* history_db); |
- |
// Initializes all index data members in preparation for restoring the index |
// from the cache or a complete rebuild from the history database. |
void Clear(); |
@@ -154,14 +164,14 @@ |
// Indexes one URL history item. |
void IndexRow(const URLRow& row); |
- // Updates or adds an history item to the index if it meets the minimum |
- // 'quick' criteria. |
- void UpdateURL(URLID row_id, const URLRow& row); |
+ // Updates or adds the history item in |row| to the index if it meets the |
+ // minimum 'quick' criteria. |
+ void UpdateURL(const URLRow& row); |
- // Deletes indexing data for an history item. The item may not have actually |
- // been indexed (which is the case if it did not previously meet minimum |
- // 'quick' criteria). |
- void DeleteURL(URLID row_id); |
+ // Deletes indexing data for the history item with the URL given in |url|. |
+ // The item may not have actually been indexed, which is the case if it did |
+ // not previously meet minimum 'quick' criteria. |
+ void DeleteURL(const GURL& url); |
// Parses and indexes the words in the URL and page title of |row|. |
void AddRowWordsToIndex(const URLRow& row); |
@@ -215,9 +225,6 @@ |
static int ScoreComponentForMatches(const TermMatches& matches, |
size_t max_length); |
- // Determines if |gurl| has a whitelisted scheme and returns true if so. |
- bool URLSchemeIsWhitelisted(const GURL& gurl) const; |
- |
// Encode a data structure into the protobuf |cache|. |
void SavePrivateData(imui::InMemoryURLIndexCacheItem* cache) const; |
void SaveWordList(imui::InMemoryURLIndexCacheItem* cache) const; |
@@ -235,6 +242,9 @@ |
bool RestoreWordIDHistoryMap(const imui::InMemoryURLIndexCacheItem& cache); |
bool RestoreHistoryInfoMap(const imui::InMemoryURLIndexCacheItem& cache); |
+ // Determines if |gurl| has a whitelisted scheme and returns true if so. |
+ bool URLSchemeIsWhitelisted(const GURL& gurl) const; |
+ |
// Cache of search terms. |
SearchTermCacheMap search_term_cache_; |