| OLD | NEW |
| 1 // Copyright (c) 2010 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_INTERFACE_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 class URLRequestThrottlerHeaderInterface; | 15 class URLRequestThrottlerHeaderInterface; |
| 16 | 16 |
| 17 // Interface provided on entries of the URL request throttler manager. | 17 // Interface provided on entries of the URL request throttler manager. |
| 18 class URLRequestThrottlerEntryInterface | 18 class URLRequestThrottlerEntryInterface |
| 19 : public base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface> { | 19 : public base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface> { |
| 20 public: | 20 public: |
| 21 URLRequestThrottlerEntryInterface() {} | 21 URLRequestThrottlerEntryInterface() {} |
| 22 | 22 |
| 23 // Returns true when we have encountered server errors and are doing | 23 // Returns true when we have encountered server errors and are doing |
| 24 // exponential back-off. | 24 // exponential back-off. |
| 25 // net::URLRequestHttpJob checks this method prior to every request; it | 25 // URLRequestHttpJob checks this method prior to every request; it |
| 26 // cancels requests if this method returns true. | 26 // cancels requests if this method returns true. |
| 27 virtual bool IsDuringExponentialBackoff() const = 0; | 27 virtual bool IsDuringExponentialBackoff() const = 0; |
| 28 | 28 |
| 29 // Calculates a recommended sending time for the next request and reserves it. | 29 // Calculates a recommended sending time for the next request and reserves it. |
| 30 // The sending time is not earlier than the current exponential back-off | 30 // The sending time is not earlier than the current exponential back-off |
| 31 // release time or |earliest_time|. Moreover, the previous results of | 31 // release time or |earliest_time|. Moreover, the previous results of |
| 32 // the method are taken into account, in order to make sure they are spread | 32 // the method are taken into account, in order to make sure they are spread |
| 33 // properly over time. | 33 // properly over time. |
| 34 // Returns the recommended delay before sending the next request, in | 34 // Returns the recommended delay before sending the next request, in |
| 35 // milliseconds. The return value is always positive or 0. | 35 // milliseconds. The return value is always positive or 0. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 56 virtual ~URLRequestThrottlerEntryInterface() {} | 56 virtual ~URLRequestThrottlerEntryInterface() {} |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; | 59 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; |
| 60 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); | 60 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace net | 63 } // namespace net |
| 64 | 64 |
| 65 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ | 65 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| OLD | NEW |