Index: components/metrics/metrics_reporting_scheduler.cc |
diff --git a/components/metrics/metrics_reporting_scheduler.cc b/components/metrics/metrics_reporting_scheduler.cc |
index fb5461bd92e38717caaffc01a902118fa4f58de5..1318b22b3abbdab366f7e2e1d624fdfff663280f 100644 |
--- a/components/metrics/metrics_reporting_scheduler.cc |
+++ b/components/metrics/metrics_reporting_scheduler.cc |
@@ -5,7 +5,6 @@ |
#include "components/metrics/metrics_reporting_scheduler.h" |
#include "base/compiler_specific.h" |
-#include "base/metrics/field_trial.h" |
#include "base/metrics/histogram.h" |
#include "base/strings/string_number_conversions.h" |
#include "components/variations/variations_associated_data.h" |
@@ -35,14 +34,6 @@ const int kUnsentLogsIntervalSeconds = 3; |
const int kUnsentLogsIntervalSeconds = 15; |
#endif |
-// Standard interval between log uploads, in seconds. |
-#if defined(OS_ANDROID) || defined(OS_IOS) |
-const int kStandardUploadIntervalSeconds = 5 * 60; // Five minutes. |
-const int kStandardUploadIntervalCellularSeconds = 15 * 60; // Fifteen minutes. |
-#else |
-const int kStandardUploadIntervalSeconds = 30 * 60; // Thirty minutes. |
-#endif |
- |
// When uploading metrics to the server fails, we progressively wait longer and |
// longer before sending the next log. This backoff process helps reduce load |
// on a server that is having issues. |
@@ -71,47 +62,23 @@ void LogActualUploadInterval(TimeDelta interval) { |
50); |
} |
-// Returns upload interval specified for the current experiment running. |
-// TODO(gayane): Only for experimenting with upload interval for Android |
-// (bug: 17391128). Should be removed once the experiments are done. |
-base::TimeDelta GetUploadIntervalFromExperiment() { |
- std::string interval_str = variations::GetVariationParamValue( |
- "UMALogUploadInterval", "interval"); |
- int interval; |
- if (interval_str.empty() || !base::StringToInt(interval_str, &interval)) |
- return TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); |
- |
- return TimeDelta::FromMinutes(interval); |
-} |
- |
-#if defined(OS_ANDROID) || defined(OS_IOS) |
-// Returns true if the user is assigned to the experiment group for enabled |
-// cellular uploads. |
-bool IsCellularEnabledByExperiment() { |
- const std::string group_name = |
- base::FieldTrialList::FindFullName("UMA_EnableCellularLogUpload"); |
- return group_name == "Enabled"; |
-} |
-#endif |
- |
} // anonymous namespace |
MetricsReportingScheduler::MetricsReportingScheduler( |
const base::Closure& upload_callback, |
- const base::Callback<void(bool*)>& cellular_callback) |
+ const base::Callback<base::TimeDelta(void)>& upload_interval_callback) |
: upload_callback_(upload_callback), |
upload_interval_(TimeDelta::FromSeconds(kInitialUploadIntervalSeconds)), |
running_(false), |
callback_pending_(false), |
init_task_complete_(false), |
waiting_for_init_task_complete_(false), |
- cellular_callback_(cellular_callback) { |
+ upload_interval_callback_(upload_interval_callback) { |
} |
MetricsReportingScheduler::~MetricsReportingScheduler() {} |
void MetricsReportingScheduler::Start() { |
- GetUploadIntervalFromExperiment(); |
running_ = true; |
ScheduleNextUpload(); |
} |
@@ -206,15 +173,7 @@ void MetricsReportingScheduler::BackOffUploadInterval() { |
} |
base::TimeDelta MetricsReportingScheduler::GetStandardUploadInterval() { |
-#if defined(OS_ANDROID) || defined(OS_IOS) |
- bool is_cellular = false; |
- if (!cellular_callback_.is_null()) |
- cellular_callback_.Run(&is_cellular); |
- |
- if (is_cellular && IsCellularEnabledByExperiment()) |
- return TimeDelta::FromSeconds(kStandardUploadIntervalCellularSeconds); |
-#endif |
- return TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); |
+ return upload_interval_callback_.Run(); |
} |
} // namespace metrics |