| Index: net/base/backoff_entry.h
|
| diff --git a/net/base/backoff_entry.h b/net/base/backoff_entry.h
|
| index dbc7488b7a4bd8005b5d699da8158d3a5459685c..be9d510474e9bd7bb0988b114ebee4cb93f6fad8 100644
|
| --- a/net/base/backoff_entry.h
|
| +++ b/net/base/backoff_entry.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef NET_BASE_BACKOFF_ENTRY_H_
|
| #define NET_BASE_BACKOFF_ENTRY_H_
|
|
|
| +#include "base/macros.h"
|
| #include "base/threading/non_thread_safe.h"
|
| #include "base/time/time.h"
|
| #include "net/base/net_export.h"
|
| @@ -22,7 +23,8 @@ namespace net {
|
| // intended for reuse in various networking scenarios.
|
| class NET_EXPORT BackoffEntry : NON_EXPORTED_BASE(public base::NonThreadSafe) {
|
| public:
|
| - // The set of parameters that define a back-off policy.
|
| + // The set of parameters that define a back-off policy. When modifying this,
|
| + // increment SERIALIZATION_VERSION_NUMBER in backoff_entry_serializer.cc.
|
| struct Policy {
|
| // Number of initial errors (in sequence) to ignore before applying
|
| // exponential back-off rules.
|
| @@ -80,9 +82,15 @@ class NET_EXPORT BackoffEntry : NON_EXPORTED_BASE(public base::NonThreadSafe) {
|
| // state) will no longer reject requests.
|
| base::TimeTicks GetReleaseTime() const;
|
|
|
| - // Returns the time until a request can be sent.
|
| + // Returns the time until a request can be sent (will be zero if the release
|
| + // time is in the past).
|
| base::TimeDelta GetTimeUntilRelease() const;
|
|
|
| + // Converts |backoff_duration| to a release time, by adding it to
|
| + // GetTimeTicksNow(), limited by maximum_backoff_ms.
|
| + base::TimeTicks BackoffDurationToReleaseTime(
|
| + base::TimeDelta backoff_duration) const;
|
| +
|
| // Causes this object reject requests until the specified absolute time.
|
| // This can be used to e.g. implement support for a Retry-After header.
|
| void SetCustomReleaseTime(const base::TimeTicks& release_time);
|
| @@ -98,6 +106,9 @@ class NET_EXPORT BackoffEntry : NON_EXPORTED_BASE(public base::NonThreadSafe) {
|
| // Returns the failure count for this entry.
|
| int failure_count() const { return failure_count_; }
|
|
|
| + // Returns the TickClock passed in to the constructor. May be NULL.
|
| + base::TickClock* tick_clock() const { return clock_; }
|
| +
|
| private:
|
| // Calculates when requests should again be allowed through.
|
| base::TimeTicks CalculateReleaseTime() const;
|
|
|