| 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 class NET_TEST BackoffEntry : NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 20 public: | 21 public: |
| 21 // The set of parameters that define a back-off policy. | 22 // The set of parameters that define a back-off policy. |
| 22 struct Policy { | 23 struct Policy { |
| 23 // Number of initial errors (in sequence) to ignore before applying | 24 // Number of initial errors (in sequence) to ignore before applying |
| 24 // exponential back-off rules. | 25 // exponential back-off rules. |
| 25 int num_errors_to_ignore; | 26 int num_errors_to_ignore; |
| 26 | 27 |
| 27 // Initial delay for exponential back-off. | 28 // Initial delay for exponential back-off. |
| 28 int initial_backoff_ms; | 29 int initial_backoff_ms; |
| 29 | 30 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 int failure_count_; | 86 int failure_count_; |
| 86 | 87 |
| 87 const Policy* const policy_; | 88 const Policy* const policy_; |
| 88 | 89 |
| 89 DISALLOW_COPY_AND_ASSIGN(BackoffEntry); | 90 DISALLOW_COPY_AND_ASSIGN(BackoffEntry); |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 } // namespace net | 93 } // namespace net |
| 93 | 94 |
| 94 #endif // NET_BASE_BACKOFF_ITEM_H_ | 95 #endif // NET_BASE_BACKOFF_ITEM_H_ |
| OLD | NEW |