Chromium Code Reviews| Index: components/metrics/data_use_tracker.cc |
| diff --git a/components/metrics/data_use_tracker.cc b/components/metrics/data_use_tracker.cc |
| index 6e3f9b3eb8afd6b77022a3094d01de6216951e6b..48cd1d5110d350ad1275a15477cd4480c6a20996 100644 |
| --- a/components/metrics/data_use_tracker.cc |
| +++ b/components/metrics/data_use_tracker.cc |
| @@ -16,6 +16,11 @@ namespace metrics { |
| namespace { |
| +// Default weekly quota and allowed UMA ratio for UMA log uploads. Can be |
| +// overridden by variation params. |
| +const int kDefaultUMAWeeklyQuotaBytes = 204800; |
| +const double kDefaultUMARatio = 0.05; |
| + |
| // This function is for forwarding metrics usage pref changes to the appropriate |
| // callback on the appropriate thread. |
| // TODO(gayane): Reduce the frequency of posting tasks from IO to UI thread. |
| @@ -170,23 +175,36 @@ int DataUseTracker::ComputeTotalDataUse(const std::string& pref_name) { |
| bool DataUseTracker::GetUmaWeeklyQuota(int* uma_weekly_quota_bytes) const { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| + // If user is not in the experiment then there shouldn't be any limitations. |
| + std::string experiment_group = |
| + base::FieldTrialList::FindFullName("UMA_EnableCellularLogUpload"); |
|
Alexei Svitkine (slow)
2016/05/13 20:21:09
We wanted to not have this experiment check anymor
gayane -on leave until 09-2017
2016/05/13 20:43:00
Done.
|
| + if (experiment_group.empty()) |
| + return false; |
| + |
| std::string param_value_str = variations::GetVariationParamValue( |
| "UMA_EnableCellularLogUpload", "Uma_Quota"); |
| if (param_value_str.empty()) |
| - return false; |
| - |
| - base::StringToInt(param_value_str, uma_weekly_quota_bytes); |
| + *uma_weekly_quota_bytes = kDefaultUMAWeeklyQuotaBytes; |
| + else |
| + base::StringToInt(param_value_str, uma_weekly_quota_bytes); |
| return true; |
| } |
| bool DataUseTracker::GetUmaRatio(double* ratio) const { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| + // If user is not in the experiment then there shouldn't be any limitations. |
| + std::string experiment_group = |
| + base::FieldTrialList::FindFullName("UMA_EnableCellularLogUpload"); |
| + if (experiment_group.empty()) |
| + return false; |
| + |
| std::string param_value_str = variations::GetVariationParamValue( |
| "UMA_EnableCellularLogUpload", "Uma_Ratio"); |
| if (param_value_str.empty()) |
| - return false; |
| - base::StringToDouble(param_value_str, ratio); |
| + *ratio = kDefaultUMARatio; |
| + else |
| + base::StringToDouble(param_value_str, ratio); |
| return true; |
| } |