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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_database.h

Issue 10896048: Transition safe browsing from bloom filter to prefix set. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix prefix set read/write for empty/sparse sets. Created 8 years, 3 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/safe_browsing/safe_browsing_database.h
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h
index 9d22428a1272a4922f32f7af4046af90e978458c..a7010fbdc8c768e2604fe453555d24cd439dcb70 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.h
+++ b/chrome/browser/safe_browsing/safe_browsing_database.h
@@ -133,7 +133,7 @@ class SafeBrowsingDatabase {
// db.DeleteChunks(chunks_deletes);
//
// // If passed true, processes the collected chunk info and
- // // rebuilds the bloom filter. If passed false, rolls everything
+ // // rebuilds the filter. If passed false, rolls everything
// // back.
// db.UpdateFinished(success);
// }
@@ -158,6 +158,9 @@ class SafeBrowsingDatabase {
// The name of the bloom-filter file for the given database file.
static FilePath BloomFilterForFilename(const FilePath& db_filename);
+ // The name of the prefix set file for the given database file.
+ static FilePath PrefixSetForFilename(const FilePath& db_filename);
+
// Filename for malware and phishing URL database.
static FilePath BrowseDBFilename(const FilePath& db_base_filename);
@@ -189,6 +192,11 @@ class SafeBrowsingDatabase {
FAILURE_DOWNLOAD_DATABASE_UPDATE_FINISH,
FAILURE_WHITELIST_DATABASE_UPDATE_BEGIN,
FAILURE_WHITELIST_DATABASE_UPDATE_FINISH,
+ FAILURE_DATABASE_PREFIX_SET_MISSING,
+ FAILURE_DATABASE_PREFIX_SET_READ,
+ FAILURE_DATABASE_PREFIX_SET_WRITE,
+ FAILURE_DATABASE_PREFIX_SET_DELETE,
+
// Memory space for histograms is determined by the max. ALWAYS
// ADD NEW VALUES BEFORE THIS ONE.
FAILURE_DATABASE_MAX
@@ -267,11 +275,11 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase {
// Deletes the files on disk.
bool Delete();
- // Load the bloom filter off disk, or generates one if it doesn't exist.
- void LoadBloomFilter();
+ // Load the prefix set or bloom filter off disk, if available.
+ void LoadBloomFilterOrPrefixSet();
- // Writes the current bloom filter to disk.
- void WriteBloomFilter();
+ // Writes the current prefix set to disk.
+ void WritePrefixSet();
// Loads the given full-length hashes to the given whitelist. If the number
// of hashes is too large or if the kill switch URL is on the whitelist
@@ -319,9 +327,9 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase {
MessageLoop* creation_loop_;
// Lock for protecting access to variables that may be used on the
- // IO thread. This includes |browse_bloom_filter_|, |full_browse_hashes_|,
- // |pending_browse_hashes_|, |prefix_miss_cache_|, |csd_whitelist_|, and
- // |csd_whitelist_all_urls_|.
+ // IO thread. This includes |browse_bloom_filter_|, |prefix_set_|,
+ // |full_browse_hashes_|, |pending_browse_hashes_|,
+ // |prefix_miss_cache_|, |csd_whitelist_|, and |csd_whitelist_all_urls_|.
base::Lock lookup_lock_;
// Underlying persistent store for chunk data.
@@ -348,6 +356,7 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase {
// Bloom filter generated from the add-prefixes in |browse_store_|.
// Only browse_store_ requires the BloomFilter for fast query.
+ // TODO(shess): Do not use, being replaced by prefix_set_.
FilePath bloom_filter_filename_;
scoped_refptr<BloomFilter> browse_bloom_filter_;
@@ -377,6 +386,7 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase {
bool change_detected_;
// Used to check if a prefix was in the database.
+ FilePath prefix_set_filename_;
scoped_ptr<safe_browsing::PrefixSet> prefix_set_;
};
« no previous file with comments | « chrome/browser/safe_browsing/prefix_set_unittest.cc ('k') | chrome/browser/safe_browsing/safe_browsing_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698