Chromium Code Reviews| Index: net/url_request/request_throttler_entry_interface.h |
| =================================================================== |
| --- net/url_request/request_throttler_entry_interface.h (revision 0) |
| +++ net/url_request/request_throttler_entry_interface.h (revision 0) |
| @@ -0,0 +1,48 @@ |
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_URL_REQUEST_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| +#define NET_URL_REQUEST_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| + |
| +#include "base/ref_counted.h" |
| +#include "base/time.h" |
| + |
| +class RequestThrottlerHeaderInterface; |
| + |
| +// Interface provided on entries of the request throttler manager. |
| +class RequestThrottlerEntryInterface |
| + : public base::RefCountedThreadSafe<RequestThrottlerEntryInterface> { |
| + public: |
| + RequestThrottlerEntryInterface() {} |
| + |
| + // Returns true when we have encountered server errors and are doing |
| + // exponential back-off. |
| + // URLRequestHttpJob checks this method prior to every request; it cancels |
| + // requests if this method returns true. |
| + virtual bool IsDuringExponentialBackoff() const = 0; |
| + |
| + // Returns the recommended delay before sending the next request, in |
| + // milliseconds. The return value is always positive or 0. |
| + // Although it is not mandatory, respecting the value returned by this method |
| + // is helpful to avoid traffic overload. |
| + virtual int64 GetRecommendedDelayForNextRequest() = 0; |
|
willchan no longer on Chromium
2010/11/17 20:32:34
You should include basictypes.h for the int64 defi
yzshen
2010/11/19 23:51:36
Done.
|
| + |
| + // This method needs to be called each time a response is received. |
| + virtual void UpdateWithResponse( |
| + const RequestThrottlerHeaderInterface* response) = 0; |
| + |
| + // Lets higher-level modules, that know how to parse particular response |
| + // bodies, notify of receiving malformed content for the given URL. This will |
| + // be handled by the throttler as if an HTTP 5xx response had been received to |
| + // the request, i.e. it will count as a failure. |
| + virtual void ReceivedContentWasMalformed() = 0; |
| + |
| + protected: |
| + virtual ~RequestThrottlerEntryInterface() {} |
| + private: |
|
willchan no longer on Chromium
2010/11/17 20:32:34
Please refer to http://google-styleguide.googlecod
yzshen
2010/11/19 23:51:36
Done.
|
| + friend class base::RefCountedThreadSafe<RequestThrottlerEntryInterface>; |
| + DISALLOW_COPY_AND_ASSIGN(RequestThrottlerEntryInterface); |
| +}; |
| + |
| +#endif // NET_URL_REQUEST_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
| Property changes on: net\url_request\request_throttler_entry_interface.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |