Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_BASE_BACKOFF_ENTRY_H_ | 5 #ifndef NET_BASE_BACKOFF_ENTRY_H_ |
| 6 #define NET_BASE_BACKOFF_ENTRY_H_ | 6 #define NET_BASE_BACKOFF_ENTRY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class TickClock; | 16 class TickClock; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 // Provides the core logic needed for randomized exponential back-off | 21 // Provides the core logic needed for randomized exponential back-off |
| 22 // on requests to a given resource, given a back-off policy. | 22 // on requests to a given resource, given a back-off policy. |
| 23 // | 23 // |
| 24 // This utility class knows nothing about network specifics; it is | 24 // This utility class knows nothing about network specifics; it is |
| 25 // intended for reuse in various networking scenarios. | 25 // intended for reuse in various networking scenarios. |
| 26 class NET_EXPORT BackoffEntry : NON_EXPORTED_BASE(public base::NonThreadSafe) { | 26 class NET_EXPORT BackoffEntry : NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 27 friend class BackoffEntrySerializer; | |
|
johnme
2016/10/03 12:18:22
Reviewers in https://codereview.chromium.org/10234
Olivier
2016/10/03 12:29:24
Done.
| |
| 28 | |
| 27 public: | 29 public: |
| 28 // The set of parameters that define a back-off policy. When modifying this, | 30 // The set of parameters that define a back-off policy. When modifying this, |
| 29 // increment SERIALIZATION_VERSION_NUMBER in backoff_entry_serializer.cc. | 31 // increment SERIALIZATION_VERSION_NUMBER in backoff_entry_serializer.cc. |
| 30 struct Policy { | 32 struct Policy { |
| 31 // Number of initial errors (in sequence) to ignore before applying | 33 // Number of initial errors (in sequence) to ignore before applying |
| 32 // exponential back-off rules. | 34 // exponential back-off rules. |
| 33 int num_errors_to_ignore; | 35 int num_errors_to_ignore; |
| 34 | 36 |
| 35 // Initial delay. The interpretation of this value depends on | 37 // Initial delay. The interpretation of this value depends on |
| 36 // always_use_initial_delay. It's either how long we wait between | 38 // always_use_initial_delay. It's either how long we wait between |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 const Policy* const policy_; // Not owned. | 130 const Policy* const policy_; // Not owned. |
| 129 | 131 |
| 130 base::TickClock* const clock_; // Not owned. | 132 base::TickClock* const clock_; // Not owned. |
| 131 | 133 |
| 132 DISALLOW_COPY_AND_ASSIGN(BackoffEntry); | 134 DISALLOW_COPY_AND_ASSIGN(BackoffEntry); |
| 133 }; | 135 }; |
| 134 | 136 |
| 135 } // namespace net | 137 } // namespace net |
| 136 | 138 |
| 137 #endif // NET_BASE_BACKOFF_ENTRY_H_ | 139 #endif // NET_BASE_BACKOFF_ENTRY_H_ |
| OLD | NEW |