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

Unified Diff: ios/chrome/browser/metrics/ios_chrome_metrics_service_client.cc

Issue 1818613002: Implement UMA log throttling for cellular connections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix param order Created 4 years, 9 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: ios/chrome/browser/metrics/ios_chrome_metrics_service_client.cc
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.cc b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.cc
index cb480c2716d2aa9eee7840b8854d79adf9305a8b..7a81bae755b10b3ddb158e63aacd9898f3082758 100644
--- a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.cc
+++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.cc
@@ -57,18 +57,18 @@ namespace {
const int kStandardUploadIntervalSeconds = 5 * 60; // Five minutes.
const int kStandardUploadIntervalCellularSeconds = 15 * 60; // Fifteen minutes.
-// Returns true if current connection type is cellular and user is assigned to
-// experimental group for enabled cellular uploads.
-bool IsCellularLogicEnabled() {
+// Assigns true to output param if current connection type is cellular and user
+// is assigned to experimental group for enabled cellular uploads.
Alexei Svitkine (slow) 2016/03/31 20:00:40 What's the reason for this change? Seems like this
gayane -on leave until 09-2017 2016/03/31 21:55:10 I changed this function not to have a return value
+void IsCellularLogicEnabled(bool* out_is_enabled) {
if (variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
"Enabled") != "true" ||
variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
"Optimize") == "false") {
- return false;
+ *out_is_enabled = false;
+ } else {
+ *out_is_enabled = net::NetworkChangeNotifier::IsConnectionCellular(
+ net::NetworkChangeNotifier::GetConnectionType());
}
-
- return net::NetworkChangeNotifier::IsConnectionCellular(
- net::NetworkChangeNotifier::GetConnectionType());
}
} // namespace
@@ -185,7 +185,9 @@ IOSChromeMetricsServiceClient::CreateUploader(
}
base::TimeDelta IOSChromeMetricsServiceClient::GetStandardUploadInterval() {
- if (IsCellularLogicEnabled())
+ bool is_cellular = false;
+ IsCellularLogicEnabled(&is_cellular);
+ if (is_cellular)
return base::TimeDelta::FromSeconds(kStandardUploadIntervalCellularSeconds);
return base::TimeDelta::FromSeconds(kStandardUploadIntervalSeconds);
}

Powered by Google App Engine
This is Rietveld 408576698