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

Unified Diff: components/domain_reliability/scheduler.h

Issue 709333003: Revert of Domain Reliability: Switch to BackoffEntry in Scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@parse_retry_after_header
Patch Set: 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
« no previous file with comments | « no previous file | components/domain_reliability/scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/domain_reliability/scheduler.h
diff --git a/components/domain_reliability/scheduler.h b/components/domain_reliability/scheduler.h
index 5d387c9db58d4d0a2f729c7eefde4bdbd12c36d6..95b2fbfa8f926343f482187b3969e4a050dabc00 100644
--- a/components/domain_reliability/scheduler.h
+++ b/components/domain_reliability/scheduler.h
@@ -8,10 +8,8 @@
#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;
@@ -73,22 +71,28 @@
base::Value* GetWebUIData() const;
- // Disables jitter in BackoffEntries to make scheduling deterministic for
- // unit tests.
- void MakeDeterministicForTesting();
+ private:
+ struct CollectorState {
+ CollectorState();
- private:
+ // The number of consecutive failures to upload to this collector, or 0 if
+ // the most recent upload succeeded.
+ unsigned failures;
+ base::TimeTicks next_upload;
+ };
+
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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698