Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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_RAPPOR_H_ | |
| 6 #define COMPONENTS_RAPPOR_RAPPOR_H_ | |
| 7 | |
| 8 #include <assert.h> | |
| 9 #include <limits.h> | |
| 10 #include <math.h> | |
| 11 | |
| 12 #include <string> | |
| 13 #include <vector> | |
| 14 | |
| 15 #include "components/rappor/bloom_filter.h" | |
| 16 #include "components/rappor/byte_vector_utils.h" | |
| 17 #include "components/rappor/rappor_parameters.h" | |
| 18 | |
| 19 namespace rappor { | |
| 20 | |
| 21 // A RapporMetric is an object that collects string samples into a Bloom filter, | |
| 22 // and generates randomized reports about the collected data. | |
| 23 // | |
| 24 // For a full description of the rappor metrics, see | |
| 25 // http://www.chromium.org/developers/design-documents/rappor | |
| 26 class RapporMetric { | |
| 27 public: | |
| 28 RapporMetric(const RapporParameters& parameters); | |
|
Alexei Svitkine (slow)
2014/01/21 18:14:04
Nit: add explicit keyword
Steven Holte
2014/01/21 20:25:14
Done.
| |
| 29 | |
|
Alexei Svitkine (slow)
2014/01/21 18:14:04
Nit: Add explicit dtor and implement in the .cc fi
Steven Holte
2014/01/21 20:25:14
Done.
| |
| 30 // Record additional samples in the Bloom filter. | |
| 31 void AddSamples(const std::vector<std::string>& strings); | |
| 32 void AddSample(const std::string& str); | |
| 33 | |
| 34 // Retrieves the current Bloom filter bits. | |
| 35 const ByteVector& bytes() const { return bloom_.bytes(); } | |
| 36 const RapporParameters* parameters() const { return ¶meters_; } | |
| 37 | |
| 38 ByteVector GetReport(const std::string& secret) const; | |
|
Alexei Svitkine (slow)
2014/01/21 18:14:04
Document this.
Steven Holte
2014/01/21 20:25:14
Done.
| |
| 39 | |
| 40 private: | |
| 41 const RapporParameters parameters_; | |
| 42 BloomFilter bloom_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(RapporMetric); | |
| 45 }; | |
| 46 | |
| 47 } // namespace rappor | |
| 48 | |
| 49 #endif // COMPONENTS_RAPPOR_RAPPOR_H_ | |
| OLD | NEW |