| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DOMAIN_RELIABILITY_SCHEDULER_H_ | 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_SCHEDULER_H_ |
| 6 #define COMPONENTS_DOMAIN_RELIABILITY_SCHEDULER_H_ | 6 #define COMPONENTS_DOMAIN_RELIABILITY_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 base::Value* GetWebUIData() const; | 75 base::Value* GetWebUIData() const; |
| 76 | 76 |
| 77 // Disables jitter in BackoffEntries to make scheduling deterministic for | 77 // Disables jitter in BackoffEntries to make scheduling deterministic for |
| 78 // unit tests. | 78 // unit tests. |
| 79 void MakeDeterministicForTesting(); | 79 void MakeDeterministicForTesting(); |
| 80 | 80 |
| 81 // Gets the time of the first beacon that has not yet been successfully | 81 // Gets the time of the first beacon that has not yet been successfully |
| 82 // uploaded. | 82 // uploaded. |
| 83 base::TimeTicks first_beacon_time() const { return first_beacon_time_; } | 83 base::TimeTicks first_beacon_time() const { return first_beacon_time_; } |
| 84 | 84 |
| 85 // Gets the time until the next upload attempt on the last collector used. |
| 86 // This will be 0 if the upload was a success; it does not take into account |
| 87 // minimum_upload_delay and maximum_upload_delay. |
| 88 base::TimeDelta last_collector_retry_delay() const { |
| 89 return last_collector_retry_delay_; |
| 90 } |
| 91 |
| 85 private: | 92 private: |
| 86 void MaybeScheduleUpload(); | 93 void MaybeScheduleUpload(); |
| 87 | 94 |
| 88 void GetNextUploadTimeAndCollector(base::TimeTicks now, | 95 void GetNextUploadTimeAndCollector(base::TimeTicks now, |
| 89 base::TimeTicks* upload_time_out, | 96 base::TimeTicks* upload_time_out, |
| 90 size_t* collector_index_out); | 97 size_t* collector_index_out); |
| 91 | 98 |
| 92 MockableTime* time_; | 99 MockableTime* time_; |
| 93 Params params_; | 100 Params params_; |
| 94 ScheduleUploadCallback callback_; | 101 ScheduleUploadCallback callback_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 112 // |OnUploadStart| and cleared in |OnUploadComplete|.) | 119 // |OnUploadStart| and cleared in |OnUploadComplete|.) |
| 113 size_t collector_index_; | 120 size_t collector_index_; |
| 114 | 121 |
| 115 // Time of the first beacon that was not included in the last successful | 122 // Time of the first beacon that was not included in the last successful |
| 116 // upload. | 123 // upload. |
| 117 base::TimeTicks first_beacon_time_; | 124 base::TimeTicks first_beacon_time_; |
| 118 | 125 |
| 119 // first_beacon_time_ saved during uploads. Restored if upload fails. | 126 // first_beacon_time_ saved during uploads. Restored if upload fails. |
| 120 base::TimeTicks old_first_beacon_time_; | 127 base::TimeTicks old_first_beacon_time_; |
| 121 | 128 |
| 129 // Time until the next upload attempt on the last collector used. (Saved for |
| 130 // histograms in Context.) |
| 131 base::TimeDelta last_collector_retry_delay_; |
| 132 |
| 122 // Extra bits to return in GetWebUIData. | 133 // Extra bits to return in GetWebUIData. |
| 123 base::TimeTicks scheduled_min_time_; | 134 base::TimeTicks scheduled_min_time_; |
| 124 base::TimeTicks scheduled_max_time_; | 135 base::TimeTicks scheduled_max_time_; |
| 125 // Whether the other last_upload_* fields are populated. | 136 // Whether the other last_upload_* fields are populated. |
| 126 bool last_upload_finished_; | 137 bool last_upload_finished_; |
| 127 base::TimeTicks last_upload_start_time_; | 138 base::TimeTicks last_upload_start_time_; |
| 128 base::TimeTicks last_upload_end_time_; | 139 base::TimeTicks last_upload_end_time_; |
| 129 size_t last_upload_collector_index_; | 140 size_t last_upload_collector_index_; |
| 130 bool last_upload_success_; | 141 bool last_upload_success_; |
| 131 }; | 142 }; |
| 132 | 143 |
| 133 } // namespace domain_reliability | 144 } // namespace domain_reliability |
| 134 | 145 |
| 135 #endif // COMPONENTS_DOMAIN_RELIABILITY_SCHEDULER_H_ | 146 #endif // COMPONENTS_DOMAIN_RELIABILITY_SCHEDULER_H_ |
| OLD | NEW |