Chromium Code Reviews| Index: components/rappor/rappor_service.cc |
| diff --git a/components/rappor/rappor_service.cc b/components/rappor/rappor_service.cc |
| index 01e6ab07000ed6517e6edc20314aa2f64418ae9f..445747e743620c7205f8caac5748b7fe6fa0a4bf 100644 |
| --- a/components/rappor/rappor_service.cc |
| +++ b/components/rappor/rappor_service.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/prefs/pref_service.h" |
| #include "base/rand_util.h" |
| #include "base/stl_util.h" |
| +#include "base/sys_info.h" |
|
Alexei Svitkine (slow)
2014/05/20 06:59:49
What's this for?
Steven Holte
2014/05/20 22:53:53
Not used in this revision. Removed.
|
| #include "base/time/time.h" |
| #include "components/metrics/metrics_hashes.h" |
| #include "components/rappor/log_uploader.h" |
| @@ -22,9 +23,6 @@ namespace rappor { |
| namespace { |
| -// The number of cohorts we divide clients into. |
| -const int kNumCohorts = 32; |
| - |
| // Seconds before the initial log is generated. |
| const int kInitialLogIntervalSeconds = 15; |
| // Interval between ongoing logs. |
| @@ -46,12 +44,13 @@ GURL GetServerUrl() { |
| const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = { |
| // ETLD_PLUS_ONE_RAPPOR_TYPE |
| - {16 /* Bloom filter size bytes */, |
| + {128 /* Num cohorts */, |
| + 16 /* Bloom filter size bytes */, |
| 2 /* Bloom filter hash count */, |
| - rappor::PROBABILITY_75 /* Fake data probability */, |
| + rappor::PROBABILITY_50 /* Fake data probability */, |
| rappor::PROBABILITY_50 /* Fake one probability */, |
| rappor::PROBABILITY_75 /* One coin probability */, |
| - rappor::PROBABILITY_50 /* Zero coin probability */}, |
| + rappor::PROBABILITY_25 /* Zero coin probability */}, |
| }; |
| } // namespace |
| @@ -96,20 +95,20 @@ void RapporService::OnLogInterval() { |
| // static |
| void RapporService::RegisterPrefs(PrefRegistrySimple* registry) { |
| registry->RegisterStringPref(prefs::kRapporSecret, std::string()); |
| - registry->RegisterIntegerPref(prefs::kRapporCohort, -1); |
| + registry->RegisterIntegerPref(prefs::kRapporCohortSeed, -1); |
| } |
| void RapporService::LoadCohort(PrefService* pref_service) { |
| DCHECK(!IsInitialized()); |
| - cohort_ = pref_service->GetInteger(prefs::kRapporCohort); |
| + cohort_ = pref_service->GetInteger(prefs::kRapporCohortSeed); |
| // If the user is already assigned to a valid cohort, we're done. |
| - if (cohort_ >= 0 && cohort_ < kNumCohorts) |
| + if (cohort_ >= 0 && cohort_ < RapporParameters::kMaxCohorts) |
| return; |
| // This is the first time the client has started the service (or their |
| // preferences were corrupted). Randomly assign them to a cohort. |
| - cohort_ = base::RandGenerator(kNumCohorts); |
| - pref_service->SetInteger(prefs::kRapporCohort, cohort_); |
| + cohort_ = base::RandGenerator(RapporParameters::kMaxCohorts); |
| + pref_service->SetInteger(prefs::kRapporCohortSeed, cohort_); |
| } |
| void RapporService::LoadSecret(PrefService* pref_service) { |