| 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_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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Returns the time after which requests are allowed. | 42 // Returns the time after which requests are allowed. |
| 43 virtual base::TimeTicks GetExponentialBackoffReleaseTime() const = 0; | 43 virtual base::TimeTicks GetExponentialBackoffReleaseTime() const = 0; |
| 44 | 44 |
| 45 // This method needs to be called each time a response is received. | 45 // This method needs to be called each time a response is received. |
| 46 virtual void UpdateWithResponse( | 46 virtual void UpdateWithResponse( |
| 47 const std::string& host, | 47 const std::string& host, |
| 48 const URLRequestThrottlerHeaderInterface* response) = 0; | 48 const URLRequestThrottlerHeaderInterface* response) = 0; |
| 49 | 49 |
| 50 // Lets higher-level modules, that know how to parse particular response | 50 // Lets higher-level modules, that know how to parse particular response |
| 51 // bodies, notify of receiving malformed content for the given URL. This will | 51 // bodies, notify of receiving malformed content for the given URL. This will |
| 52 // be handled by the throttler as if an HTTP 5xx response had been received to | 52 // be handled by the throttler as if an HTTP 503 response had been received to |
| 53 // the request, i.e. it will count as a failure. | 53 // the request, i.e. it will count as a failure, unless the HTTP status code |
| 54 virtual void ReceivedContentWasMalformed() = 0; | 54 // indicated is already one of those that will be counted as an error. |
| 55 virtual void ReceivedContentWasMalformed(int status_code) = 0; |
| 55 | 56 |
| 56 protected: | 57 protected: |
| 57 friend class base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface>; | 58 friend class base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface>; |
| 58 virtual ~URLRequestThrottlerEntryInterface() {} | 59 virtual ~URLRequestThrottlerEntryInterface() {} |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; | 62 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; |
| 62 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); | 63 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 } // namespace net | 66 } // namespace net |
| 66 | 67 |
| 67 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ | 68 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| OLD | NEW |