diff options
author | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-11 02:17:51 +0000 |
---|---|---|
committer | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-11 02:17:51 +0000 |
commit | c3ff8949df1905e2c0bffe32527a4b11de212ccc (patch) | |
tree | ffb88432b79882716a8779aee7a15efec6f3c65e /chrome/browser/safe_browsing/safe_browsing_database.h | |
parent | 95218fbcd0b0e804175ada19cd8f95f5818242ba (diff) | |
download | chromium_src-c3ff8949df1905e2c0bffe32527a4b11de212ccc.zip chromium_src-c3ff8949df1905e2c0bffe32527a4b11de212ccc.tar.gz chromium_src-c3ff8949df1905e2c0bffe32527a4b11de212ccc.tar.bz2 |
Add support for 256 bit full hashes to the new implementation.
This CL replaces the following, which seems to have become inaccessible:
http://codereview.chromium.org/9202/
Review URL: http://codereview.chromium.org/10402
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5159 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing/safe_browsing_database.h')
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_database.h | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h index f4c692a..9e07297 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.h +++ b/chrome/browser/safe_browsing/safe_browsing_database.h @@ -6,9 +6,11 @@ #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ #include <deque> +#include <list> #include <string> #include <vector> +#include "base/hash_tables.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/task.h" @@ -80,7 +82,10 @@ class SafeBrowsingDatabase { // Called when the user's machine has resumed from a lower power state. virtual void HandleResume() = 0; - virtual void UpdateFinished(bool update_succeeded) { } + virtual void UpdateStarted() {} + virtual void UpdateFinished(bool update_succeeded) {} + + virtual std::wstring filename() const { return filename_; } protected: static std::wstring BloomFilterFilename(const std::wstring& db_filename); @@ -98,8 +103,31 @@ class SafeBrowsingDatabase { virtual void BuildBloomFilter() = 0; // Measuring false positive rate. Call this each time we look in the filter. - virtual void IncrementBloomFilterReadCount() {}; + virtual void IncrementBloomFilterReadCount() {} + + // Full hash cache support. + friend class SafeBrowsingDatabase_HashCaching_Test; + + typedef struct HashCacheEntry { + SBFullHash full_hash; + int list_id; + int add_chunk_id; + int sub_chunk_id; + base::Time received; + } HashCacheEntry; + + typedef std::list<HashCacheEntry> HashList; + typedef base::hash_map<SBPrefix, HashList> HashCache; + + scoped_ptr<HashCache> hash_cache_; + HashCache* hash_cache() { return hash_cache_.get(); } + + // Cache of prefixes that returned empty results (no full hash match). + typedef std::set<SBPrefix> PrefixCache; + PrefixCache prefix_miss_cache_; + PrefixCache* prefix_miss_cache() { return &prefix_miss_cache_; } + std::wstring filename_; std::wstring bloom_filter_filename_; scoped_refptr<BloomFilter> bloom_filter_; }; |