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

Side by Side Diff: components/metrics/metrics_upload_scheduler.cc

Issue 2608833002: Move logic for uploading logs into a ReportingService object. (Closed)
Patch Set: Rebase again Created 3 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 unified diff | Download patch
« no previous file with comments | « components/metrics/metrics_upload_scheduler.h ('k') | components/metrics/reporting_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/metrics/metrics_upload_scheduler.h" 5 #include "components/metrics/metrics_upload_scheduler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/feature_list.h" 9 #include "base/feature_list.h"
10 #include "base/metrics/field_trial_params.h" 10 #include "base/metrics/field_trial_params.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 void MetricsUploadScheduler::StopAndUploadCancelled() { 98 void MetricsUploadScheduler::StopAndUploadCancelled() {
99 Stop(); 99 Stop();
100 TaskDone(unsent_logs_interval_); 100 TaskDone(unsent_logs_interval_);
101 } 101 }
102 102
103 void MetricsUploadScheduler::UploadOverDataUsageCap() { 103 void MetricsUploadScheduler::UploadOverDataUsageCap() {
104 TaskDone(base::TimeDelta::FromMinutes(kOverDataUsageIntervalMinutes)); 104 TaskDone(base::TimeDelta::FromMinutes(kOverDataUsageIntervalMinutes));
105 } 105 }
106 106
107 void MetricsUploadScheduler::LogActualUploadInterval(base::TimeDelta interval) {
108 UMA_HISTOGRAM_CUSTOM_COUNTS("UMA.ActualLogUploadInterval",
109 interval.InMinutes(), 1,
110 base::TimeDelta::FromHours(12).InMinutes(), 50);
111 }
112
113 void MetricsUploadScheduler::TriggerTask() {
114 if (!last_upload_finish_time_.is_null()) {
115 LogActualUploadInterval(base::TimeTicks::Now() - last_upload_finish_time_);
116 last_upload_finish_time_ = base::TimeTicks();
117 }
118 MetricsScheduler::TriggerTask();
119 }
120
121 } // namespace metrics 107 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_upload_scheduler.h ('k') | components/metrics/reporting_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698