Index: net/url_request/url_request_throttler_manager.h |
diff --git a/net/url_request/url_request_throttler_manager.h b/net/url_request/url_request_throttler_manager.h |
index 427b42e9f2f87b062ed83e0418b81fee5b47ffc1..15a3eeddf77766b999203ad7726eaa812b5afb5a 100644 |
--- a/net/url_request/url_request_throttler_manager.h |
+++ b/net/url_request/url_request_throttler_manager.h |
@@ -24,6 +24,16 @@ namespace net { |
class BoundNetLog; |
class NetLog; |
+class NET_EXPORT URLRequestThrottlerManagerDelegate { |
+ public: |
+ virtual ~URLRequestThrottlerManagerDelegate() {} |
+ |
+ // Returns true if the URLRequestThrottlerManager may reject the |
+ // request in question if it believe the server servicing the |
+ // request to be overloaded or down. |
+ virtual bool MayRejectRequest(URLRequest* request) = 0; |
eroman
2012/06/05 05:30:25
Same comment as earlier, please make |request| con
Jói
2012/06/05 16:39:14
Done.
|
+}; |
+ |
// Class that registers URL request throttler entries for URLs being accessed |
// in order to supervise traffic. URL requests for HTTP contents should |
// register their URLs in this manager on each request. |
@@ -38,7 +48,8 @@ class NET_EXPORT URLRequestThrottlerManager |
public NetworkChangeNotifier::IPAddressObserver, |
public NetworkChangeNotifier::ConnectionTypeObserver { |
public: |
- URLRequestThrottlerManager(); |
+ explicit URLRequestThrottlerManager( |
+ URLRequestThrottlerManagerDelegate* delegate); |
eroman
2012/06/05 05:30:25
Please describe ownership semantics (i.e. that |de
Jói
2012/06/05 16:39:14
This concern goes away with the switch to NetworkD
|
virtual ~URLRequestThrottlerManager(); |
// Must be called for every request, returns the URL request throttler entry |
@@ -113,6 +124,8 @@ class NET_EXPORT URLRequestThrottlerManager |
int GetNumberOfEntriesForTests() const { return url_entries_.size(); } |
private: |
+ friend class URLRequestThrottlerEntry; |
+ |
// From each URL we generate an ID composed of the scheme, host, port and path |
// that allows us to uniquely map an entry to it. |
typedef std::map<std::string, scoped_refptr<URLRequestThrottlerEntry> > |
@@ -141,10 +154,6 @@ class NET_EXPORT URLRequestThrottlerManager |
// Valid after construction. |
GURL::Replacements url_id_replacements_; |
- // Whether we would like to reject outgoing HTTP requests during the back-off |
- // period. |
- bool enforce_throttling_; |
- |
// Certain tests do not obey the net component's threading policy, so we |
// keep track of whether we're being used by tests, and turn off certain |
// checks. |
@@ -163,6 +172,8 @@ class NET_EXPORT URLRequestThrottlerManager |
// Valid once we've registered for network notifications. |
base::PlatformThreadId registered_from_thread_; |
+ URLRequestThrottlerManagerDelegate* delegate_; |
+ |
DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager); |
}; |