OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ITEM_H_ | 5 #ifndef NET_BASE_BACKOFF_ITEM_H_ |
6 #define NET_BASE_BACKOFF_ITEM_H_ | 6 #define NET_BASE_BACKOFF_ITEM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "net/base/net_api.h" |
11 | 12 |
12 namespace net { | 13 namespace net { |
13 | 14 |
14 // Provides the core logic needed for randomized exponential back-off | 15 // Provides the core logic needed for randomized exponential back-off |
15 // on requests to a given resource, given a back-off policy. | 16 // on requests to a given resource, given a back-off policy. |
16 // | 17 // |
17 // This utility class knows nothing about network specifics; it is | 18 // This utility class knows nothing about network specifics; it is |
18 // intended for reuse in various networking scenarios. | 19 // intended for reuse in various networking scenarios. |
19 class BackoffEntry : public base::NonThreadSafe { | 20 MSVC_SUPPRESS_WARNING(4275) |
| 21 class NET_TEST BackoffEntry : public base::NonThreadSafe { |
20 public: | 22 public: |
21 // The set of parameters that define a back-off policy. | 23 // The set of parameters that define a back-off policy. |
22 struct Policy { | 24 struct Policy { |
23 // Number of initial errors (in sequence) to ignore before applying | 25 // Number of initial errors (in sequence) to ignore before applying |
24 // exponential back-off rules. | 26 // exponential back-off rules. |
25 int num_errors_to_ignore; | 27 int num_errors_to_ignore; |
26 | 28 |
27 // Initial delay for exponential back-off. | 29 // Initial delay for exponential back-off. |
28 int initial_backoff_ms; | 30 int initial_backoff_ms; |
29 | 31 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 int failure_count_; | 87 int failure_count_; |
86 | 88 |
87 const Policy* const policy_; | 89 const Policy* const policy_; |
88 | 90 |
89 DISALLOW_COPY_AND_ASSIGN(BackoffEntry); | 91 DISALLOW_COPY_AND_ASSIGN(BackoffEntry); |
90 }; | 92 }; |
91 | 93 |
92 } // namespace net | 94 } // namespace net |
93 | 95 |
94 #endif // NET_BASE_BACKOFF_ITEM_H_ | 96 #endif // NET_BASE_BACKOFF_ITEM_H_ |
OLD | NEW |