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 #include "net/base/net_export.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 // Provides the core logic needed for randomized exponential back-off | 15 // Provides the core logic needed for randomized exponential back-off |
16 // on requests to a given resource, given a back-off policy. | 16 // on requests to a given resource, given a back-off policy. |
17 // | 17 // |
18 // This utility class knows nothing about network specifics; it is | 18 // This utility class knows nothing about network specifics; it is |
19 // intended for reuse in various networking scenarios. | 19 // intended for reuse in various networking scenarios. |
20 class NET_TEST BackoffEntry : NON_EXPORTED_BASE(public base::NonThreadSafe) { | 20 class NET_EXPORT_PRIVATE BackoffEntry |
| 21 : NON_EXPORTED_BASE(public base::NonThreadSafe) { |
21 public: | 22 public: |
22 // The set of parameters that define a back-off policy. | 23 // The set of parameters that define a back-off policy. |
23 struct Policy { | 24 struct Policy { |
24 // Number of initial errors (in sequence) to ignore before applying | 25 // Number of initial errors (in sequence) to ignore before applying |
25 // exponential back-off rules. | 26 // exponential back-off rules. |
26 int num_errors_to_ignore; | 27 int num_errors_to_ignore; |
27 | 28 |
28 // Initial delay for exponential back-off. | 29 // Initial delay for exponential back-off. |
29 int initial_backoff_ms; | 30 int initial_backoff_ms; |
30 | 31 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 int failure_count_; | 92 int failure_count_; |
92 | 93 |
93 const Policy* const policy_; | 94 const Policy* const policy_; |
94 | 95 |
95 DISALLOW_COPY_AND_ASSIGN(BackoffEntry); | 96 DISALLOW_COPY_AND_ASSIGN(BackoffEntry); |
96 }; | 97 }; |
97 | 98 |
98 } // namespace net | 99 } // namespace net |
99 | 100 |
100 #endif // NET_BASE_BACKOFF_ITEM_H_ | 101 #endif // NET_BASE_BACKOFF_ITEM_H_ |
OLD | NEW |