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

Side by Side Diff: components/rappor/bloom_filter.h

Issue 49753002: RAPPOR implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_RAPPOR_BLOOM_FILTER_H_
6 #define COMPONENTS_RAPPOR_BLOOM_FILTER_H_
7
8 #include <stdint.h>
9
10 #include <string>
11 #include <vector>
12
13 #include "base/basictypes.h"
14 #include "components/rappor/byte_vector_utils.h"
15
16 namespace rappor {
17
18 // BloomFilter is a simple bloom filter for keeping track of a set of strings.
Ilya Sherman 2014/01/10 11:00:32 nit: "bloom filter" -> "Bloom filter", since "Bloo
Steven Holte 2014/01/14 00:47:54 Done.
19 class BloomFilter {
Ilya Sherman 2014/01/10 11:00:32 Hmm, I'm going to be we already have a Bloom filte
Steven Holte 2014/01/14 00:47:54 Yes. Extracting safebrowsing's bloom filter looks
20 public:
21 BloomFilter(uint32_t bytes_size, uint32_t hash_count);
Ilya Sherman 2014/01/10 11:00:32 nit: Please document the parameters, including the
Steven Holte 2014/01/14 00:47:54 Done.
22 ~BloomFilter();
23
24 void AddString(const std::string& str);
25 void AddStrings(const std::vector<std::string>& strings);
Ilya Sherman 2014/01/10 11:00:32 nit: Please document these methods (fine to be ver
Steven Holte 2014/01/14 00:47:54 Done.
26
27 // Returns the current value of the bloom filter's bit array.
28 const ByteVector& bytes() const { return bytes_; };
29 // Returns the number of bits set for each string added to the filter.
30 uint32_t hash_count() const { return hash_count_; };
31
32 private:
33 // Stores the bit array of the bloom filter.
Ilya Sherman 2014/01/10 11:00:32 Optional nit: "bit array" -> "byte array"?
Steven Holte 2014/01/14 00:47:54 Done.
34 ByteVector bytes_;
35 // The number of bits to set for each string added.
36 uint32_t hash_count_;
Ilya Sherman 2014/01/10 11:00:32 nit: This might be more clear if named something l
Steven Holte 2014/01/14 00:47:54 Done.
37
38 DISALLOW_COPY_AND_ASSIGN(BloomFilter);
39 };
40
41 } // namespace rappor
42
43 #endif // COMPONENTS_RAPPOR_BLOOM_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698