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

Unified Diff: components/domain_reliability/scheduler.h

Issue 704893002: Domain Reliability: Switch to BackoffEntry in Scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@parse_retry_after_header
Patch Set: And a couple other things Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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.
« no previous file with comments | « no previous file | components/domain_reliability/scheduler.cc » ('j') | components/domain_reliability/scheduler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698