| 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/ref_counted.h" |  10 #include "base/ref_counted.h" | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|  36   // Although it is not mandatory, respecting the value returned by this method |  36   // Although it is not mandatory, respecting the value returned by this method | 
|  37   // is helpful to avoid traffic overload. |  37   // is helpful to avoid traffic overload. | 
|  38   virtual int64 ReserveSendingTimeForNextRequest( |  38   virtual int64 ReserveSendingTimeForNextRequest( | 
|  39       const base::TimeTicks& earliest_time) = 0; |  39       const base::TimeTicks& earliest_time) = 0; | 
|  40  |  40  | 
|  41   // Returns the time after which requests are allowed. |  41   // Returns the time after which requests are allowed. | 
|  42   virtual base::TimeTicks GetExponentialBackoffReleaseTime() const = 0; |  42   virtual base::TimeTicks GetExponentialBackoffReleaseTime() const = 0; | 
|  43  |  43  | 
|  44   // This method needs to be called each time a response is received. |  44   // This method needs to be called each time a response is received. | 
|  45   virtual void UpdateWithResponse( |  45   virtual void UpdateWithResponse( | 
 |  46       const std::string& host, | 
|  46       const URLRequestThrottlerHeaderInterface* response) = 0; |  47       const URLRequestThrottlerHeaderInterface* response) = 0; | 
|  47  |  48  | 
|  48   // Lets higher-level modules, that know how to parse particular response |  49   // Lets higher-level modules, that know how to parse particular response | 
|  49   // bodies, notify of receiving malformed content for the given URL. This will |  50   // bodies, notify of receiving malformed content for the given URL. This will | 
|  50   // be handled by the throttler as if an HTTP 5xx response had been received to |  51   // be handled by the throttler as if an HTTP 5xx response had been received to | 
|  51   // the request, i.e. it will count as a failure. |  52   // the request, i.e. it will count as a failure. | 
|  52   virtual void ReceivedContentWasMalformed() = 0; |  53   virtual void ReceivedContentWasMalformed() = 0; | 
|  53  |  54  | 
|  54  protected: |  55  protected: | 
|  55   friend class base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface>; |  56   friend class base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface>; | 
|  56   virtual ~URLRequestThrottlerEntryInterface() {} |  57   virtual ~URLRequestThrottlerEntryInterface() {} | 
|  57  |  58  | 
|  58  private: |  59  private: | 
|  59   friend class base::RefCounted<URLRequestThrottlerEntryInterface>; |  60   friend class base::RefCounted<URLRequestThrottlerEntryInterface>; | 
|  60   DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); |  61   DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); | 
|  61 }; |  62 }; | 
|  62  |  63  | 
|  63 }  // namespace net |  64 }  // namespace net | 
|  64  |  65  | 
|  65 #endif  // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |  66 #endif  // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ | 
| OLD | NEW |