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_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 12 matching lines...) Expand all Loading... |
23 // It analyzes requests of a specific URL over some period of time, in order to | 23 // It analyzes requests of a specific URL over some period of time, in order to |
24 // deduce the back-off time for every request. | 24 // deduce the back-off time for every request. |
25 // The back-off algorithm consists of two parts. Firstly, exponential back-off | 25 // The back-off algorithm consists of two parts. Firstly, exponential back-off |
26 // is used when receiving 5XX server errors or malformed response bodies. | 26 // is used when receiving 5XX server errors or malformed response bodies. |
27 // The exponential back-off rule is enforced by URLRequestHttpJob. Any | 27 // The exponential back-off rule is enforced by URLRequestHttpJob. Any |
28 // request sent during the back-off period will be cancelled. | 28 // request sent during the back-off period will be cancelled. |
29 // Secondly, a sliding window is used to count recent requests to a given | 29 // Secondly, a sliding window is used to count recent requests to a given |
30 // destination and provide guidance (to the application level only) on whether | 30 // destination and provide guidance (to the application level only) on whether |
31 // too many requests have been sent and when a good time to send the next one | 31 // too many requests have been sent and when a good time to send the next one |
32 // would be. This is never used to deny requests at the network level. | 32 // would be. This is never used to deny requests at the network level. |
33 class NET_API URLRequestThrottlerEntry | 33 class NET_EXPORT URLRequestThrottlerEntry |
34 : public URLRequestThrottlerEntryInterface { | 34 : public URLRequestThrottlerEntryInterface { |
35 public: | 35 public: |
36 // Sliding window period. | 36 // Sliding window period. |
37 static const int kDefaultSlidingWindowPeriodMs; | 37 static const int kDefaultSlidingWindowPeriodMs; |
38 | 38 |
39 // Maximum number of requests allowed in sliding window period. | 39 // Maximum number of requests allowed in sliding window period. |
40 static const int kDefaultMaxSendThreshold; | 40 static const int kDefaultMaxSendThreshold; |
41 | 41 |
42 // Number of initial errors to ignore before starting exponential back-off. | 42 // Number of initial errors to ignore before starting exponential back-off. |
43 static const int kDefaultNumErrorsToIgnore; | 43 static const int kDefaultNumErrorsToIgnore; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 std::string url_id_; | 182 std::string url_id_; |
183 | 183 |
184 BoundNetLog net_log_; | 184 BoundNetLog net_log_; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntry); | 186 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntry); |
187 }; | 187 }; |
188 | 188 |
189 } // namespace net | 189 } // namespace net |
190 | 190 |
191 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ | 191 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ |
OLD | NEW |