| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_METRICS_METRICS_REPORTING_SCHEDULER_H_ | 5 #ifndef CHROME_BROWSER_METRICS_METRICS_REPORTING_SCHEDULER_H_ |
| 6 #define CHROME_BROWSER_METRICS_METRICS_REPORTING_SCHEDULER_H_ | 6 #define CHROME_BROWSER_METRICS_METRICS_REPORTING_SCHEDULER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Callback from MetricsService when a triggered upload is cancelled by the | 31 // Callback from MetricsService when a triggered upload is cancelled by the |
| 32 // MetricsService. | 32 // MetricsService. |
| 33 void UploadCancelled(); | 33 void UploadCancelled(); |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 // Timer callback indicating it's time for the MetricsService to upload | 36 // Timer callback indicating it's time for the MetricsService to upload |
| 37 // metrics. | 37 // metrics. |
| 38 void TriggerUpload(); | 38 void TriggerUpload(); |
| 39 | 39 |
| 40 // Schedules a future call to TriggerUpload if one isn't already pending. | 40 // Schedules a future call to TriggerUpload if one isn't already pending. |
| 41 void ScheduleNextCallback(); | 41 void ScheduleNextUpload(); |
| 42 | 42 |
| 43 // Increases the upload interval each time it's called, to handle the case | 43 // Increases the upload interval each time it's called, to handle the case |
| 44 // where the server is having issues. | 44 // where the server is having issues. |
| 45 void BackOffUploadInterval(); | 45 void BackOffUploadInterval(); |
| 46 | 46 |
| 47 // The MetricsService method to call when uploading should happen. | 47 // The MetricsService method to call when uploading should happen. |
| 48 base::Closure upload_callback_; | 48 const base::Closure upload_callback_; |
| 49 | 49 |
| 50 base::OneShotTimer<MetricsReportingScheduler> upload_timer_; | 50 base::OneShotTimer<MetricsReportingScheduler> upload_timer_; |
| 51 | 51 |
| 52 // The interval between being told an upload is done and starting the next | 52 // The interval between being told an upload is done and starting the next |
| 53 // upload. | 53 // upload. |
| 54 base::TimeDelta upload_interval_; | 54 base::TimeDelta upload_interval_; |
| 55 | 55 |
| 56 // Indicates that the scheduler is running (i.e., that Start has been called | 56 // Indicates that the scheduler is running (i.e., that Start has been called |
| 57 // more recently than Stop). | 57 // more recently than Stop). |
| 58 bool running_; | 58 bool running_; |
| 59 | 59 |
| 60 // Indicates that the last triggered upload hasn't resolved yet. | 60 // Indicates that the last triggered upload hasn't resolved yet. |
| 61 bool callback_pending_; | 61 bool callback_pending_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(MetricsReportingScheduler); | 63 DISALLOW_COPY_AND_ASSIGN(MetricsReportingScheduler); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 #endif // CHROME_BROWSER_METRICS_METRICS_REPORTING_SCHEDULER_H_ | 66 #endif // CHROME_BROWSER_METRICS_METRICS_REPORTING_SCHEDULER_H_ |
| OLD | NEW |