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

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

Issue 2608833002: Move logic for uploading logs into a ReportingService object. (Closed)
Patch Set: Fix iOS/Android typo 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
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 #ifndef COMPONENTS_METRICS_METRICS_UPLOAD_SCHEDULER_H_ 5 #ifndef COMPONENTS_METRICS_METRICS_UPLOAD_SCHEDULER_H_
6 #define COMPONENTS_METRICS_METRICS_UPLOAD_SCHEDULER_H_ 6 #define COMPONENTS_METRICS_METRICS_UPLOAD_SCHEDULER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/feature_list.h" 9 #include "base/feature_list.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 18 matching lines...) Expand all
29 29
30 // Callback from MetricsService when an upload is cancelled. 30 // Callback from MetricsService when an upload is cancelled.
31 // Also stops the scheduler. 31 // Also stops the scheduler.
32 void StopAndUploadCancelled(); 32 void StopAndUploadCancelled();
33 33
34 // Callback from MetricsService when an upload is cancelled because it would 34 // Callback from MetricsService when an upload is cancelled because it would
35 // be over the allowed data usage cap. 35 // be over the allowed data usage cap.
36 void UploadOverDataUsageCap(); 36 void UploadOverDataUsageCap();
37 37
38 private: 38 private:
39 // Record the upload interval time.
40 virtual void LogActualUploadInterval(base::TimeDelta interval);
41
42 // MetricsScheduler:
43 void TriggerTask() override;
44
45 // The tick count of the last time log upload has been finished and null if no
46 // upload has been done yet.
47 base::TimeTicks last_upload_finish_time_;
48
49 // Time to wait between uploads on success. 39 // Time to wait between uploads on success.
50 const base::TimeDelta unsent_logs_interval_; 40 const base::TimeDelta unsent_logs_interval_;
51 41
52 // Initial time to wait between upload retry attempts. 42 // Initial time to wait between upload retry attempts.
53 const base::TimeDelta initial_backoff_interval_; 43 const base::TimeDelta initial_backoff_interval_;
54 44
55 // Time to wait for the next upload attempt if the next one fails. 45 // Time to wait for the next upload attempt if the next one fails.
56 base::TimeDelta backoff_interval_; 46 base::TimeDelta backoff_interval_;
57 47
58 DISALLOW_COPY_AND_ASSIGN(MetricsUploadScheduler); 48 DISALLOW_COPY_AND_ASSIGN(MetricsUploadScheduler);
59 }; 49 };
60 50
61 } // namespace metrics 51 } // namespace metrics
62 52
63 #endif // COMPONENTS_METRICS_METRICS_UPLOAD_SCHEDULER_H_ 53 #endif // COMPONENTS_METRICS_METRICS_UPLOAD_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698