| 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 10 matching lines...) Expand all Loading... |
| 21 // It analyzes requests of a specific URL over some period of time, in order to | 21 // It analyzes requests of a specific URL over some period of time, in order to |
| 22 // deduce the back-off time for every request. | 22 // deduce the back-off time for every request. |
| 23 // The back-off algorithm consists of two parts. Firstly, exponential back-off | 23 // The back-off algorithm consists of two parts. Firstly, exponential back-off |
| 24 // is used when receiving 5XX server errors or malformed response bodies. | 24 // is used when receiving 5XX server errors or malformed response bodies. |
| 25 // The exponential back-off rule is enforced by URLRequestHttpJob. Any | 25 // The exponential back-off rule is enforced by URLRequestHttpJob. Any |
| 26 // request sent during the back-off period will be cancelled. | 26 // request sent during the back-off period will be cancelled. |
| 27 // Secondly, a sliding window is used to count recent requests to a given | 27 // Secondly, a sliding window is used to count recent requests to a given |
| 28 // destination and provide guidance (to the application level only) on whether | 28 // destination and provide guidance (to the application level only) on whether |
| 29 // too many requests have been sent and when a good time to send the next one | 29 // too many requests have been sent and when a good time to send the next one |
| 30 // would be. This is never used to deny requests at the network level. | 30 // would be. This is never used to deny requests at the network level. |
| 31 class URLRequestThrottlerEntry : public URLRequestThrottlerEntryInterface { | 31 class NET_API URLRequestThrottlerEntry |
| 32 : public URLRequestThrottlerEntryInterface { |
| 32 public: | 33 public: |
| 33 // Sliding window period. | 34 // Sliding window period. |
| 34 static const int kDefaultSlidingWindowPeriodMs; | 35 static const int kDefaultSlidingWindowPeriodMs; |
| 35 | 36 |
| 36 // Maximum number of requests allowed in sliding window period. | 37 // Maximum number of requests allowed in sliding window period. |
| 37 static const int kDefaultMaxSendThreshold; | 38 static const int kDefaultMaxSendThreshold; |
| 38 | 39 |
| 39 // Number of initial errors to ignore before starting exponential back-off. | 40 // Number of initial errors to ignore before starting exponential back-off. |
| 40 static const int kDefaultNumErrorsToIgnore; | 41 static const int kDefaultNumErrorsToIgnore; |
| 41 | 42 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 156 |
| 156 // Weak back-reference to the manager object managing us. | 157 // Weak back-reference to the manager object managing us. |
| 157 URLRequestThrottlerManager* manager_; | 158 URLRequestThrottlerManager* manager_; |
| 158 | 159 |
| 159 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntry); | 160 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntry); |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 } // namespace net | 163 } // namespace net |
| 163 | 164 |
| 164 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ | 165 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ |
| OLD | NEW |