Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: net/url_request/request_throttler_entry_interface.h

Issue 4194001: Implement exponential back-off mechanism and enforce it at the URLRequestHttpJob level. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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_URL_REQUEST_REQUEST_THROTTLER_ENTRY_INTERFACE_H_
6 #define NET_URL_REQUEST_REQUEST_THROTTLER_ENTRY_INTERFACE_H_
7
8 #include "base/ref_counted.h"
9 #include "base/time.h"
10
11 class RequestThrottlerHeaderInterface;
12
13 // Interface provided on entries 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;
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.
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 // Lets higher-level modules, that know how to parse particular response
36 // bodies, notify of receiving malformed content for the given URL. This will
37 // be handled by the throttler as if an HTTP 5xx response had been received to
38 // the request, i.e. it will count as a failure.
39 virtual void ReceivedContentWasMalformed() = 0;
40
41 protected:
42 virtual ~RequestThrottlerEntryInterface() {}
43 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.
44 friend class base::RefCountedThreadSafe<RequestThrottlerEntryInterface>;
45 DISALLOW_COPY_AND_ASSIGN(RequestThrottlerEntryInterface);
46 };
47
48 #endif // NET_URL_REQUEST_REQUEST_THROTTLER_ENTRY_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698