Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: net/base/backoff_entry.h

Issue 2910473005: Deprecate NonThreadSafe in net/ in favor of SequenceChecker/ThreadChecker. (Closed)
Patch Set: another compile nit Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/sequence_checker.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 {
27 public: 27 public:
28 // The set of parameters that define a back-off policy. When modifying this, 28 // The set of parameters that define a back-off policy. When modifying this,
29 // increment SERIALIZATION_VERSION_NUMBER in backoff_entry_serializer.cc. 29 // increment SERIALIZATION_VERSION_NUMBER in backoff_entry_serializer.cc.
30 struct Policy { 30 struct Policy {
31 // Number of initial errors (in sequence) to ignore before applying 31 // Number of initial errors (in sequence) to ignore before applying
32 // exponential back-off rules. 32 // exponential back-off rules.
33 int num_errors_to_ignore; 33 int num_errors_to_ignore;
34 34
35 // Initial delay. The interpretation of this value depends on 35 // Initial delay. The interpretation of this value depends on
36 // always_use_initial_delay. It's either how long we wait between 36 // always_use_initial_delay. It's either how long we wait between
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // allowed to start sending requests again. 119 // allowed to start sending requests again.
120 base::TimeTicks exponential_backoff_release_time_; 120 base::TimeTicks exponential_backoff_release_time_;
121 121
122 // Counts request errors; decremented on success. 122 // Counts request errors; decremented on success.
123 int failure_count_; 123 int failure_count_;
124 124
125 const Policy* const policy_; // Not owned. 125 const Policy* const policy_; // Not owned.
126 126
127 base::TickClock* const clock_; // Not owned. 127 base::TickClock* const clock_; // Not owned.
128 128
129 SEQUENCE_CHECKER(sequence_checker_);
130
129 DISALLOW_COPY_AND_ASSIGN(BackoffEntry); 131 DISALLOW_COPY_AND_ASSIGN(BackoffEntry);
130 }; 132 };
131 133
132 } // namespace net 134 } // namespace net
133 135
134 #endif // NET_BASE_BACKOFF_ENTRY_H_ 136 #endif // NET_BASE_BACKOFF_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698