| Index: components/rappor/bloom_filter.cc
|
| diff --git a/components/rappor/bloom_filter.cc b/components/rappor/bloom_filter.cc
|
| index d3f9e6339328714bc301237173e4f93baee96fee..9ad8f3ca0ce9d68191e8896229dbf3d44c2e1fcc 100644
|
| --- a/components/rappor/bloom_filter.cc
|
| +++ b/components/rappor/bloom_filter.cc
|
| @@ -20,7 +20,10 @@ BloomFilter::BloomFilter(uint32_t bytes_size,
|
|
|
| BloomFilter::~BloomFilter() {}
|
|
|
| -void BloomFilter::AddString(const std::string& str) {
|
| +void BloomFilter::SetString(const std::string& str) {
|
| + for (size_t i = 0; i < bytes_.size(); ++i) {
|
| + bytes_[i] = 0;
|
| + }
|
| for (size_t i = 0; i < hash_function_count_; ++i) {
|
| // Using CityHash here because we have support for it in Dremel. Many hash
|
| // functions, such as MD5, SHA1, or Murmur, would probably also work.
|
| @@ -33,4 +36,11 @@ void BloomFilter::AddString(const std::string& str) {
|
| }
|
| }
|
|
|
| +void BloomFilter::SetBytesForTesting(const ByteVector& bytes) {
|
| + DCHECK_EQ(bytes_.size(), bytes.size());
|
| + for (size_t i = 0; i < bytes_.size(); ++i) {
|
| + bytes_[i] = bytes[i];
|
| + }
|
| +}
|
| +
|
| } // namespace rappor
|
|
|