summaryrefslogtreecommitdiffstats
path: root/chrome/browser/visitedlink_master.cc
diff options
context:
space:
mode:
authordglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-03 17:38:39 +0000
committerdglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-03 17:38:39 +0000
commit3e90d4a00082fd985ab610cd2faff84b5c597a4e (patch)
tree4d2f0da17f4fb68bab53381c9f49351380a24127 /chrome/browser/visitedlink_master.cc
parentfd694982d0e1ee8b3e1753d9c48b01c1a633ac27 (diff)
downloadchromium_src-3e90d4a00082fd985ab610cd2faff84b5c597a4e.zip
chromium_src-3e90d4a00082fd985ab610cd2faff84b5c597a4e.tar.gz
chromium_src-3e90d4a00082fd985ab610cd2faff84b5c597a4e.tar.bz2
Fix Acid3 Test 48: LINKTEST, Chromium side....
R=brettw BUG=http://crbug.com/231 BUG=http://crubg.com/5160 TEST=ExpireHistoryTest.ArchiveSomeOldHistory TEST=ExpireHistoryTest.ExpiringVisitsReader TEST=VisitedLinkTest.Listener TEST=VisitedLinkTest.Resizing TEST=VisitedLinkRelayTest.* TEST=VisitedLinkEventsTest.* Review URL: http://codereview.chromium.org/113591 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19910 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/visitedlink_master.cc')
-rw-r--r--chrome/browser/visitedlink_master.cc26
1 files changed, 17 insertions, 9 deletions
diff --git a/chrome/browser/visitedlink_master.cc b/chrome/browser/visitedlink_master.cc
index 54a3a22..41a97a1 100644
--- a/chrome/browser/visitedlink_master.cc
+++ b/chrome/browser/visitedlink_master.cc
@@ -199,24 +199,24 @@ class VisitedLinkMaster::TableBuilder : public HistoryService::URLEnumerator,
uint8 salt_[LINK_SALT_LENGTH];
// Stores the fingerprints we computed on the background thread.
- std::vector<VisitedLinkMaster::Fingerprint> fingerprints_;
+ VisitedLinkCommon::Fingerprints fingerprints_;
};
// VisitedLinkMaster ----------------------------------------------------------
VisitedLinkMaster::VisitedLinkMaster(base::Thread* file_thread,
- PostNewTableEvent* poster,
+ Listener* listener,
Profile* profile) {
- InitMembers(file_thread, poster, profile);
+ InitMembers(file_thread, listener, profile);
}
VisitedLinkMaster::VisitedLinkMaster(base::Thread* file_thread,
- PostNewTableEvent* poster,
+ Listener* listener,
HistoryService* history_service,
bool suppress_rebuild,
const FilePath& filename,
int32 default_table_size) {
- InitMembers(file_thread, poster, NULL);
+ InitMembers(file_thread, listener, NULL);
database_name_override_ = filename;
table_size_override_ = default_table_size;
@@ -236,14 +236,16 @@ VisitedLinkMaster::~VisitedLinkMaster() {
}
void VisitedLinkMaster::InitMembers(base::Thread* file_thread,
- PostNewTableEvent* poster,
+ Listener* listener,
Profile* profile) {
+ DCHECK(listener);
+
if (file_thread)
file_thread_ = file_thread->message_loop();
else
file_thread_ = NULL;
- post_new_table_event_ = poster;
+ listener_ = listener;
file_ = NULL;
shared_memory_ = NULL;
shared_memory_serial_ = 0;
@@ -348,6 +350,8 @@ void VisitedLinkMaster::DeleteAllURLs() {
// us, otherwise, schedule writing the new table to disk ourselves.
if (!ResizeTableIfNecessary())
WriteFullTable();
+
+ listener_->Reset();
}
void VisitedLinkMaster::DeleteURLs(const std::set<GURL>& urls) {
@@ -356,6 +360,8 @@ void VisitedLinkMaster::DeleteURLs(const std::set<GURL>& urls) {
if (urls.empty())
return;
+ listener_->Reset();
+
if (table_builder_) {
// A rebuild is in progress, save this deletion in the temporary list so
// it can be added once rebuild is complete.
@@ -411,6 +417,8 @@ VisitedLinkMaster::Hash VisitedLinkMaster::AddFingerprint(
// End of probe sequence found, insert here.
hash_table_[cur_hash] = fingerprint;
used_items_++;
+ // Notify listener that a new visited link was added.
+ listener_->Add(fingerprint);
return cur_hash;
}
@@ -805,7 +813,7 @@ void VisitedLinkMaster::ResizeTable(int32 new_size) {
// Send an update notification to all child processes so they read the new
// table.
- post_new_table_event_(shared_memory_);
+ listener_->NewTable(shared_memory_);
#ifndef NDEBUG
DebugValidate();
@@ -908,7 +916,7 @@ void VisitedLinkMaster::OnTableRebuildComplete(
deleted_since_rebuild_.clear();
// Send an update notification to all child processes.
- post_new_table_event_(shared_memory_);
+ listener_->NewTable(shared_memory_);
WriteFullTable();
}