| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_REQUEST_THROTTLER_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| 6 #define NET_REQUEST_THROTTLER_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| 7 |
| 8 #include "base/ref_counted.h" |
| 9 #include "base/time.h" |
| 10 |
| 11 class RequestThrottlerHeaderInterface; |
| 12 |
| 13 // Represents an entry of the request throttler manager. |
| 14 class RequestThrottlerEntryInterface |
| 15 : public base::RefCountedThreadSafe<RequestThrottlerEntryInterface> { |
| 16 public: |
| 17 RequestThrottlerEntryInterface() {} |
| 18 |
| 19 // Returns true when we have encountered server errors and are doing |
| 20 // exponential back-off. |
| 21 // URLRequestHttpJob checks this method prior to every request; it cancels |
| 22 // requests if this method returns true. |
| 23 virtual bool IsDuringExponentialBackoff() const = 0; |
| 24 |
| 25 // Returns the recommended delay before sending the next request, in |
| 26 // milliseconds. The return value is always positive or 0. |
| 27 // Although it is not mandatory, respecting the value returned by this method |
| 28 // is helpful to avoid traffic overload. |
| 29 virtual int64 GetRecommendedDelayForNextRequest() = 0; |
| 30 |
| 31 // This method needs to be called each time a response is received. |
| 32 virtual void UpdateWithResponse( |
| 33 const RequestThrottlerHeaderInterface* response) = 0; |
| 34 |
| 35 protected: |
| 36 virtual ~RequestThrottlerEntryInterface() {} |
| 37 private: |
| 38 friend class base::RefCountedThreadSafe<RequestThrottlerEntryInterface>; |
| 39 DISALLOW_COPY_AND_ASSIGN(RequestThrottlerEntryInterface); |
| 40 }; |
| 41 |
| 42 #endif // NET_REQUEST_THROTTLER_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| OLD | NEW |