diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-12 03:39:53 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-12 03:39:53 +0000 |
commit | a5fb1c5db00481df8e2707b1b1ef8ecd4d62559f (patch) | |
tree | 655b48f2ae981cc33dfe9714b36a9e4ab9cdd79c /chrome/browser/visitedlink_master.h | |
parent | d43a385b95751e8e85d68f41a979d575372b08e1 (diff) | |
download | chromium_src-a5fb1c5db00481df8e2707b1b1ef8ecd4d62559f.zip chromium_src-a5fb1c5db00481df8e2707b1b1ef8ecd4d62559f.tar.gz chromium_src-a5fb1c5db00481df8e2707b1b1ef8ecd4d62559f.tar.bz2 |
Take 2: Preload the visited link db on the file thread if
the file exists. Otherwise, just load like normal on the UI thread.
This failed before because the browser may have shutdown before the
posted task ran. When the posted task finally runs, it tried to
use the profile, but the profile was already deleted. Make a small
change to VisitedLinkMaster so GetDatabaseFileName no longer depends
on the profile.
BUG=24163
Review URL: http://codereview.chromium.org/507047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/visitedlink_master.h')
-rw-r--r-- | chrome/browser/visitedlink_master.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/chrome/browser/visitedlink_master.h b/chrome/browser/visitedlink_master.h index fc35ff9..14ba9d8 100644 --- a/chrome/browser/visitedlink_master.h +++ b/chrome/browser/visitedlink_master.h @@ -77,9 +77,18 @@ class VisitedLinkMaster : public VisitedLinkCommon { // Must be called immediately after object creation. Nothing else will work // until this is called. Returns true on success, false means that this - // object won't work. + // object won't work. You can also use InitFromFile() and InitFromScratch() + // if you need more control over loading the visited link information. bool Init(); + // Try to load the table from the database file. If the file doesn't exist or + // is corrupt, this will return failure. This method may be called from a + // background thread, but it isn't thread safe. + bool InitFromFile(); + + // Creates a new empty table, call if InitFromFile() fails. + bool InitFromScratch(); + base::SharedMemory* shared_memory() { return shared_memory_; } // Adds a URL to the table. @@ -167,10 +176,6 @@ class VisitedLinkMaster : public VisitedLinkCommon { // the table file open and the handle to it in file_ bool WriteFullTable(); - // Try to load the table from the database file. If the file doesn't exist or - // is corrupt, this will return failure. - bool InitFromFile(); - // Reads the header of the link coloring database from disk. Assumes the // file pointer is at the beginning of the file and that there are no pending // asynchronous I/O operations. @@ -222,13 +227,6 @@ class VisitedLinkMaster : public VisitedLinkCommon { // fingerprint was deleted, false if it was not in the table to delete. bool DeleteFingerprint(Fingerprint fingerprint, bool update_file); - // Creates a new empty table, call if InitFromFile() fails. Normally, when - // |suppress_rebuild| is false, the table will be rebuilt from history, - // keeping us in sync. When |suppress_rebuild| is true, the new table will be - // empty and we will not consult history. This is used when clearing the - // database and for unit tests. - bool InitFromScratch(bool suppress_rebuild); - // Allocates the Fingerprint structure and length. When init_to_empty is set, // the table will be filled with 0s and used_items_ will be set to 0 as well. // If the flag is not set, these things are untouched and it is the @@ -369,6 +367,9 @@ class VisitedLinkMaster : public VisitedLinkCommon { // will be false in production. bool suppress_rebuild_; + // Keep a copy of the profile_dir in case we outlive the profile. + FilePath profile_dir_; + DISALLOW_EVIL_CONSTRUCTORS(VisitedLinkMaster); }; |