From cf50836f5fff555ab9b8d2e961029a31514ea239 Mon Sep 17 00:00:00 2001 From: "shess@chromium.org" Date: Fri, 4 Mar 2011 01:16:58 +0000 Subject: 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 --- chrome/browser/safe_browsing/prefix_set.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'chrome/browser/safe_browsing/prefix_set.h') 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& prefixes); + explicit PrefixSet(const std::vector& 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* prefixes); + private: // Maximum delta that can be encoded in a 16-bit unsigned. static const unsigned kMaxDelta = 256 * 256; -- cgit v1.1