diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 01:16:58 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 01:16:58 +0000 |
commit | cf50836f5fff555ab9b8d2e961029a31514ea239 (patch) | |
tree | 39e6f10ca0f7876888a637103a7747e607c6451f /chrome/browser/safe_browsing/prefix_set.h | |
parent | cff8c308df4b4f2388e7bd3cbe1b462228c12d4c (diff) | |
download | chromium_src-cf50836f5fff555ab9b8d2e961029a31514ea239.zip chromium_src-cf50836f5fff555ab9b8d2e961029a31514ea239.tar.gz chromium_src-cf50836f5fff555ab9b8d2e961029a31514ea239.tar.bz2 |
Additional validation code for PrefixSet.
The PrefixSet-vs-BloomFilter histograms showed a minor discrepency,
with a very small number of PREFIX_SET_EVENT_BLOOM_MISS_PREFIX_HIT
reports. This CL adds code to regenerate the prefix list and
manually double-check.
Additionally, reduce memory use by requiring the input prefix vector
to be pre-sorted.
BUG=71832
TEST=none
Review URL: http://codereview.chromium.org/6591087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing/prefix_set.h')
-rw-r--r-- | chrome/browser/safe_browsing/prefix_set.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/chrome/browser/safe_browsing/prefix_set.h b/chrome/browser/safe_browsing/prefix_set.h index 229b772..cb2cd9f 100644 --- a/chrome/browser/safe_browsing/prefix_set.h +++ b/chrome/browser/safe_browsing/prefix_set.h @@ -59,12 +59,16 @@ namespace safe_browsing { class PrefixSet { public: - explicit PrefixSet(const std::vector<SBPrefix>& prefixes); + explicit PrefixSet(const std::vector<SBPrefix>& sorted_prefixes); ~PrefixSet(); // |true| if |prefix| was in |prefixes| passed to the constructor. bool Exists(SBPrefix prefix) const; + // Regenerate the vector of prefixes passed to the constructor into + // |prefixes|. Prefixes will be added in sorted order. + void GetPrefixes(std::vector<SBPrefix>* prefixes); + private: // Maximum delta that can be encoded in a 16-bit unsigned. static const unsigned kMaxDelta = 256 * 256; |