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

Unified Diff: net/request_throttler/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 side-by-side diff with in-line comments
Download patch
Index: net/request_throttler/request_throttler_entry_interface.h
===================================================================
--- net/request_throttler/request_throttler_entry_interface.h (revision 0)
+++ net/request_throttler/request_throttler_entry_interface.h (revision 0)
@@ -0,0 +1,42 @@
+// 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_REQUEST_THROTTLER_REQUEST_THROTTLER_ENTRY_INTERFACE_H_
+#define NET_REQUEST_THROTTLER_REQUEST_THROTTLER_ENTRY_INTERFACE_H_
+
+#include "base/ref_counted.h"
+#include "base/time.h"
+
+class RequestThrottlerHeaderInterface;
+
+// Represents an entry 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;
+
+ // This method needs to be called each time a response is received.
+ virtual void UpdateWithResponse(
+ const RequestThrottlerHeaderInterface* response) = 0;
+
+ protected:
+ virtual ~RequestThrottlerEntryInterface() {}
+ private:
+ friend class base::RefCountedThreadSafe<RequestThrottlerEntryInterface>;
+ DISALLOW_COPY_AND_ASSIGN(RequestThrottlerEntryInterface);
+};
+
+#endif // NET_REQUEST_THROTTLER_REQUEST_THROTTLER_ENTRY_INTERFACE_H_
Property changes on: net\request_throttler\request_throttler_entry_interface.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698