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

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

Issue 2390653002: Allow backoff entry serialization if clock is null. (Closed)
Patch Set: feedback Created 4 years, 2 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
« no previous file with comments | « no previous file | net/base/backoff_entry_serializer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // just as well start with a fresh BackoffEntry object), and hasn't 101 // just as well start with a fresh BackoffEntry object), and hasn't
102 // had for Policy::entry_lifetime_ms. 102 // had for Policy::entry_lifetime_ms.
103 bool CanDiscard() const; 103 bool CanDiscard() const;
104 104
105 // Resets this entry to a fresh (as if just constructed) state. 105 // Resets this entry to a fresh (as if just constructed) state.
106 void Reset(); 106 void Reset();
107 107
108 // Returns the failure count for this entry. 108 // Returns the failure count for this entry.
109 int failure_count() const { return failure_count_; } 109 int failure_count() const { return failure_count_; }
110 110
111 // Returns the TickClock passed in to the constructor. May be NULL. 111 // Equivalent to TimeTicks::Now(), using clock_ if provided.
112 base::TickClock* tick_clock() const { return clock_; } 112 base::TimeTicks GetTimeTicksNow() const;
mmenke 2016/10/03 14:30:03 Need to reorder the cc file to match the order in
113 113
114 private: 114 private:
115 // Calculates when requests should again be allowed through. 115 // Calculates when requests should again be allowed through.
116 base::TimeTicks CalculateReleaseTime() const; 116 base::TimeTicks CalculateReleaseTime() const;
117 117
118 // Equivalent to TimeTicks::Now(), using clock_ if provided.
119 base::TimeTicks GetTimeTicksNow() const;
120
121 // Timestamp calculated by the exponential back-off algorithm at which we are 118 // Timestamp calculated by the exponential back-off algorithm at which we are
122 // allowed to start sending requests again. 119 // allowed to start sending requests again.
123 base::TimeTicks exponential_backoff_release_time_; 120 base::TimeTicks exponential_backoff_release_time_;
124 121
125 // Counts request errors; decremented on success. 122 // Counts request errors; decremented on success.
126 int failure_count_; 123 int failure_count_;
127 124
128 const Policy* const policy_; // Not owned. 125 const Policy* const policy_; // Not owned.
129 126
130 base::TickClock* const clock_; // Not owned. 127 base::TickClock* const clock_; // Not owned.
131 128
132 DISALLOW_COPY_AND_ASSIGN(BackoffEntry); 129 DISALLOW_COPY_AND_ASSIGN(BackoffEntry);
133 }; 130 };
134 131
135 } // namespace net 132 } // namespace net
136 133
137 #endif // NET_BASE_BACKOFF_ENTRY_H_ 134 #endif // NET_BASE_BACKOFF_ENTRY_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/backoff_entry_serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698