| OLD | NEW |
| 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_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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // milliseconds. The return value is always positive or 0. | 44 // milliseconds. The return value is always positive or 0. |
| 45 // Although it is not mandatory, respecting the value returned by this method | 45 // Although it is not mandatory, respecting the value returned by this method |
| 46 // is helpful to avoid traffic overload. | 46 // is helpful to avoid traffic overload. |
| 47 virtual int64 ReserveSendingTimeForNextRequest( | 47 virtual int64 ReserveSendingTimeForNextRequest( |
| 48 const base::TimeTicks& earliest_time) = 0; | 48 const base::TimeTicks& earliest_time) = 0; |
| 49 | 49 |
| 50 // Returns the time after which requests are allowed. | 50 // Returns the time after which requests are allowed. |
| 51 virtual base::TimeTicks GetExponentialBackoffReleaseTime() const = 0; | 51 virtual base::TimeTicks GetExponentialBackoffReleaseTime() const = 0; |
| 52 | 52 |
| 53 // This method needs to be called each time a response is received. | 53 // This method needs to be called each time a response is received. |
| 54 virtual void UpdateWithResponse( | 54 virtual void UpdateWithResponse(int status_code) = 0; |
| 55 const std::string& host, | |
| 56 const URLRequestThrottlerHeaderInterface* response) = 0; | |
| 57 | 55 |
| 58 // Lets higher-level modules, that know how to parse particular response | 56 // Lets higher-level modules, that know how to parse particular response |
| 59 // bodies, notify of receiving malformed content for the given URL. This will | 57 // bodies, notify of receiving malformed content for the given URL. This will |
| 60 // be handled by the throttler as if an HTTP 503 response had been received to | 58 // be handled by the throttler as if an HTTP 503 response had been received to |
| 61 // the request, i.e. it will count as a failure, unless the HTTP response code | 59 // the request, i.e. it will count as a failure, unless the HTTP response code |
| 62 // indicated is already one of those that will be counted as an error. | 60 // indicated is already one of those that will be counted as an error. |
| 63 virtual void ReceivedContentWasMalformed(int response_code) = 0; | 61 virtual void ReceivedContentWasMalformed(int response_code) = 0; |
| 64 | 62 |
| 65 protected: | 63 protected: |
| 66 friend class base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface>; | 64 friend class base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface>; |
| 67 virtual ~URLRequestThrottlerEntryInterface() {} | 65 virtual ~URLRequestThrottlerEntryInterface() {} |
| 68 | 66 |
| 69 private: | 67 private: |
| 70 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; | 68 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; |
| 71 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); | 69 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); |
| 72 }; | 70 }; |
| 73 | 71 |
| 74 } // namespace net | 72 } // namespace net |
| 75 | 73 |
| 76 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ | 74 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| OLD | NEW |