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

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: fix build presubmit warning 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
« no previous file with comments | « components/metrics/BUILD.gn ('k') | components/metrics/metrics_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d97462aa9181108a730d4264254d46a47bb2150b 100644
--- a/components/metrics/data_use_tracker.cc
+++ b/components/metrics/data_use_tracker.cc
@@ -16,6 +16,12 @@ namespace metrics {
namespace {
+// Default weekly quota and allowed UMA ratio for UMA log uploads for Android.
+// These defaults will not be used for non-Android as |DataUseTracker| will not
+// be initialized. Default values 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.
@@ -41,12 +47,9 @@ DataUseTracker::~DataUseTracker() {}
std::unique_ptr<DataUseTracker> DataUseTracker::Create(
PrefService* local_state) {
std::unique_ptr<DataUseTracker> data_use_tracker;
- if (variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
- "Uma_Quota") != "" &&
- variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
- "Uma_Ratio") != "") {
- data_use_tracker.reset(new DataUseTracker(local_state));
- }
+#if defined(OS_ANDROID)
+ data_use_tracker.reset(new DataUseTracker(local_state));
+#endif
return data_use_tracker;
}
@@ -173,9 +176,9 @@ bool DataUseTracker::GetUmaWeeklyQuota(int* uma_weekly_quota_bytes) const {
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;
}
@@ -185,8 +188,9 @@ bool DataUseTracker::GetUmaRatio(double* ratio) const {
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;
}
« no previous file with comments | « components/metrics/BUILD.gn ('k') | components/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698