Index: components/domain_reliability/scheduler.h |
diff --git a/components/domain_reliability/scheduler.h b/components/domain_reliability/scheduler.h |
index 95b2fbfa8f926343f482187b3969e4a050dabc00..5d387c9db58d4d0a2f729c7eefde4bdbd12c36d6 100644 |
--- a/components/domain_reliability/scheduler.h |
+++ b/components/domain_reliability/scheduler.h |
@@ -8,8 +8,10 @@ |
#include <vector> |
#include "base/callback.h" |
+#include "base/memory/scoped_vector.h" |
#include "base/time/time.h" |
#include "components/domain_reliability/domain_reliability_export.h" |
+#include "net/base/backoff_entry.h" |
namespace base { |
class Value; |
@@ -71,28 +73,22 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityScheduler { |
base::Value* GetWebUIData() const; |
- private: |
- struct CollectorState { |
- CollectorState(); |
- |
- // The number of consecutive failures to upload to this collector, or 0 if |
- // the most recent upload succeeded. |
- unsigned failures; |
- base::TimeTicks next_upload; |
- }; |
+ // Disables jitter in BackoffEntries to make scheduling deterministic for |
+ // unit tests. |
+ void MakeDeterministicForTesting(); |
+ private: |
void MaybeScheduleUpload(); |
void GetNextUploadTimeAndCollector(base::TimeTicks now, |
base::TimeTicks* upload_time_out, |
size_t* collector_index_out); |
- base::TimeDelta GetUploadRetryInterval(unsigned failures); |
- |
MockableTime* time_; |
- std::vector<CollectorState> collectors_; |
Params params_; |
ScheduleUploadCallback callback_; |
+ net::BackoffEntry::Policy backoff_policy_; |
+ ScopedVector<net::BackoffEntry> collectors_; |
// Whether there are beacons that have not yet been uploaded. Set when a |
// beacon arrives or an upload fails, and cleared when an upload starts. |