| Index: chrome/browser/metrics/variations/variations_service.cc
|
| diff --git a/chrome/browser/metrics/variations/variations_service.cc b/chrome/browser/metrics/variations/variations_service.cc
|
| index 00c7816705d3638bc190824bbf3f7101bc93150f..4c95b077c35f676df2c10fc16e1c680acd707b52 100644
|
| --- a/chrome/browser/metrics/variations/variations_service.cc
|
| +++ b/chrome/browser/metrics/variations/variations_service.cc
|
| @@ -177,6 +177,19 @@ bool VariationsService::CreateTrialsFromSeed() {
|
| }
|
| }
|
|
|
| + // Log the "freshness" of the seed that was just used. The freshness is the
|
| + // time between the last successful seed download and now.
|
| + const int64 last_fetch_time_internal =
|
| + local_state_->GetInt64(prefs::kVariationsLastFetchTime);
|
| + if (last_fetch_time_internal) {
|
| + const base::Time now = base::Time::Now();
|
| + const base::TimeDelta delta =
|
| + now - base::Time::FromInternalValue(last_fetch_time_internal);
|
| + // Log the value in number of minutes.
|
| + UMA_HISTOGRAM_CUSTOM_COUNTS("Variations.SeedFreshness", delta.InMinutes(),
|
| + 1, base::TimeDelta::FromDays(30).InMinutes(), 50);
|
| + }
|
| +
|
| return true;
|
| }
|
|
|
| @@ -215,6 +228,7 @@ void VariationsService::RegisterPrefs(PrefRegistrySimple* registry) {
|
| registry->RegisterStringPref(prefs::kVariationsSeed, std::string());
|
| registry->RegisterInt64Pref(prefs::kVariationsSeedDate,
|
| base::Time().ToInternalValue());
|
| + registry->RegisterInt64Pref(prefs::kVariationsLastFetchTime, 0);
|
| }
|
|
|
| // static
|
| @@ -290,6 +304,10 @@ void VariationsService::OnURLFetchComplete(const net::URLFetcher* source) {
|
| }
|
| }
|
|
|
| + if (response_code == net::HTTP_NOT_MODIFIED) {
|
| + RecordLastFetchTime();
|
| + }
|
| +
|
| if (response_code != net::HTTP_OK) {
|
| DVLOG(1) << "Variations server request returned non-HTTP_OK response code: "
|
| << response_code;
|
| @@ -348,6 +366,9 @@ bool VariationsService::StoreSeedData(const std::string& seed_data,
|
| local_prefs->SetInt64(prefs::kVariationsSeedDate,
|
| seed_date.ToInternalValue());
|
| variations_serial_number_ = seed.serial_number();
|
| +
|
| + RecordLastFetchTime();
|
| +
|
| return true;
|
| }
|
|
|
| @@ -601,4 +622,9 @@ void VariationsService::CreateTrialFromStudy(const Study& study,
|
| trial->Disable();
|
| }
|
|
|
| +void VariationsService::RecordLastFetchTime() {
|
| + local_state_->SetInt64(prefs::kVariationsLastFetchTime,
|
| + base::Time::Now().ToInternalValue());
|
| +}
|
| +
|
| } // namespace chrome_variations
|
|
|