| Index: components/rappor/rappor_service.cc
|
| diff --git a/components/rappor/rappor_service.cc b/components/rappor/rappor_service.cc
|
| index 7fc4fce7fb4e86f94b330d1e6a94df7927960137..98e532f7f34a1c37390394ad654309cad03e6d3b 100644
|
| --- a/components/rappor/rappor_service.cc
|
| +++ b/components/rappor/rappor_service.cc
|
| @@ -52,6 +52,7 @@ const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = {
|
| {128 /* Num cohorts */,
|
| 16 /* Bloom filter size bytes */,
|
| 2 /* Bloom filter hash count */,
|
| + 0 /* Flag bytes */,
|
| rappor::PROBABILITY_50 /* Fake data probability */,
|
| rappor::PROBABILITY_50 /* Fake one probability */,
|
| rappor::PROBABILITY_75 /* One coin probability */,
|
| @@ -61,6 +62,7 @@ const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = {
|
| {128 /* Num cohorts */,
|
| 1 /* Bloom filter size bytes */,
|
| 2 /* Bloom filter hash count */,
|
| + 0 /* Flag bytes */,
|
| rappor::PROBABILITY_50 /* Fake data probability */,
|
| rappor::PROBABILITY_50 /* Fake one probability */,
|
| rappor::PROBABILITY_75 /* One coin probability */,
|
| @@ -259,4 +261,27 @@ RapporMetric* RapporService::LookUpMetric(const std::string& metric_name,
|
| return new_metric;
|
| }
|
|
|
| +scoped_ptr<Sample> RapporService::MakeSampleObj(RapporType type) {
|
| + DCHECK(IsInitialized());
|
| + return scoped_ptr<Sample>(
|
| + new Sample(cohort_, kRapporParametersForType[type]));
|
| +}
|
| +
|
| +void RapporService::RecordSampleObj(const std::string& metric_name,
|
| + scoped_ptr<Sample> sample) {
|
| + if (is_incognito_callback_.Run()) {
|
| + DVLOG(2) << "Metric not logged due to incognito mode.";
|
| + return;
|
| + }
|
| + // Skip this metric if it's reporting level is less than the enabled
|
| + // reporting level.
|
| + if (recording_level_ < sample->parameters().recording_level) {
|
| + DVLOG(2) << "Metric not logged due to recording_level "
|
| + << recording_level_ << " < "
|
| + << sample->parameters().recording_level;
|
| + return;
|
| + }
|
| + sampler_.AddSample(metric_name, sample.Pass());
|
| +}
|
| +
|
| } // namespace rappor
|
|
|