Index: chrome/browser/history/url_index_private_data.h |
=================================================================== |
--- chrome/browser/history/url_index_private_data.h (revision 120346) |
+++ 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 HistoryQuickProviderTest; |
+ |
namespace in_memory_url_index { |
class InMemoryURLIndexCacheItem; |
} |
@@ -19,6 +21,8 @@ |
namespace imui = in_memory_url_index; |
+class HistoryDatabase; |
+ |
// A structure describing the InMemoryURLIndex's internal data and providing for |
// restoring, rebuilding and updating that internal data. |
class URLIndexPrivateData { |
@@ -27,8 +31,9 @@ |
~URLIndexPrivateData(); |
private: |
+ friend class AddHistoryMatch; |
+ friend class HistoryQuickProviderTest; |
Peter Kasting
2012/02/07 00:12:22
Nit: Add "::" before classname
mrossetti
2012/02/07 01:10:13
Done.
|
friend class InMemoryURLIndex; |
- friend class AddHistoryMatch; |
friend class InMemoryURLIndexTest; |
FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, CacheSaveRestore); |
FRIEND_TEST_ALL_PREFIXES(InMemoryURLIndexTest, HugeResultSet); |
@@ -130,13 +135,15 @@ |
// profile directory and returns true if successful. |
bool RestoreFromFile(const FilePath& file_path); |
+ // Constructs a new object by rebuilding its contents from the history |
+ // database in |history_db|. Returns the new URLIndexPrivateData which on |
+ // success will contain the rebuilt data but upon failure will be empty. |
+ static URLIndexPrivateData* RebuildFromHistory(HistoryDatabase* 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(); |
@@ -153,17 +160,22 @@ |
// URL History indexing support functions. |
- // Indexes one URL history item. |
- void IndexRow(const URLRow& row); |
+ // Indexes one URL history item as described by |row|. Returns true if the |
+ // row was actually indexed. |
+ bool 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); |
+ // Adds the history item in |row| to the index if it does not already already |
+ // exist and it meets the minimum 'quick' criteria. If the row already exists |
+ // in the index then the index will be updated if the row still meets the |
+ // criteria, otherwise the row will be removed from the index. Returns true |
+ // if the index was actually updated. |
+ bool 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. Returns true if the index |
+ // was actually updated. |
+ bool DeleteURL(const GURL& url); |
// Parses and indexes the words in the URL and page title of |row|. |
void AddRowWordsToIndex(const URLRow& row); |