Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Unified Diff: components/metrics/data_use_tracker.cc

Issue 1974593002: Make the launch params the default client behavior for UMA 3g (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..738656c8acf45c6edef78c66dac6e84c54b587c1 100644
--- a/components/metrics/data_use_tracker.cc
+++ b/components/metrics/data_use_tracker.cc
@@ -14,6 +14,9 @@
namespace metrics {
+const int kDefaultUMAWeeklyQuotaBytes = 204800;
+const double kDefaultUMARatio = 0.05;
+
namespace {
// This function is for forwarding metrics usage pref changes to the appropriate
@@ -170,23 +173,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");
+ 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;
}

Powered by Google App Engine
This is Rietveld 408576698