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

Unified Diff: chrome/browser/history/url_index_private_data.h

Issue 9030031: Move InMemoryURLIndex Caching Operations to FILE Thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Pass bool value, not pointer. Sync to clear up Linux fails (hopefully). Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/url_index_private_data.h
===================================================================
--- chrome/browser/history/url_index_private_data.h (revision 124934)
+++ chrome/browser/history/url_index_private_data.h (working copy)
@@ -8,8 +8,10 @@
#include "base/file_path.h"
#include "base/gtest_prod_util.h"
+#include "base/memory/scoped_ptr.h"
#include "chrome/browser/history/in_memory_url_index_types.h"
#include "chrome/browser/history/in_memory_url_index_cache.pb.h"
+#include "content/public/browser/notification_details.h"
class HistoryQuickProviderTest;
@@ -22,6 +24,7 @@
namespace imui = in_memory_url_index;
class HistoryDatabase;
+class InMemoryURLIndex;
// A structure describing the InMemoryURLIndex's internal data and providing for
// restoring, rebuilding and updating that internal data.
@@ -131,23 +134,38 @@
// 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);
+ // Creates a new URLIndexPrivateData object, populates it from the contents
+ // of the cache file stored in |file_path|, and assigns it to |data|.
+ static void RestoreFromFileTask(const FilePath& file_path,
+ URLIndexPrivateData* data);
+ // 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 |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);
+ // Writes |private_data| as a cache file to |file_path| and returns success
+ // via |succeeded|.
+ static void WritePrivateDataToCacheFileTask(URLIndexPrivateData* private_data,
+ const FilePath& file_path,
+ bool* succeeded);
+
// Caches the index private data and writes the cache file to the profile
- // directory.
+ // directory. Called by WritePrivateDataToCacheFileTask.
bool SaveToFile(const FilePath& file_path);
// Initializes all index data members in preparation for restoring the index
// from the cache or a complete rebuild from the history database.
void Clear();
+ // Returns true if there is no data in the index.
+ bool Empty() const;
+
// Adds |word_id| to |history_id|'s entry in the history/word map,
// creating a new entry if one does not already exist.
void AddToHistoryIDWordMap(HistoryID history_id, WordID word_id);
@@ -230,9 +248,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;
@@ -250,6 +265,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_;

Powered by Google App Engine
This is Rietveld 408576698