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

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

Issue 10440119: Introduce a delegate to avoid hardcoding "chrome-extension" in net/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge to LKGR Created 8 years, 6 months 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
OLDNEW
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 <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 class URLRequest;
18 class URLRequestThrottlerHeaderInterface; 19 class URLRequestThrottlerHeaderInterface;
19 20
20 // Interface provided on entries of the URL request throttler manager. 21 // Interface provided on entries of the URL request throttler manager.
21 class NET_EXPORT URLRequestThrottlerEntryInterface 22 class NET_EXPORT URLRequestThrottlerEntryInterface
22 : public base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface> { 23 : public base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface> {
23 public: 24 public:
24 URLRequestThrottlerEntryInterface() {} 25 URLRequestThrottlerEntryInterface() {}
25 26
26 // Returns true when we have encountered server errors and are doing 27 // Returns true when we have encountered server errors and are doing
27 // exponential back-off, unless the request has |load_flags| (from 28 // exponential back-off, unless the request has |load_flags| (from
28 // net/base/load_flags.h) that mean it is likely to be 29 // net/base/load_flags.h) that mean it is likely to be
29 // user-initiated. 30 // user-initiated, or the URLRequestThrottlerManagerDelegate returns
31 // false for |MayRejectRequest(request)|.
30 // 32 //
31 // URLRequestHttpJob checks this method prior to every request; it 33 // URLRequestHttpJob checks this method prior to every request; it
32 // cancels requests if this method returns true. 34 // cancels requests if this method returns true.
33 virtual bool ShouldRejectRequest(int load_flags) const = 0; 35 virtual bool ShouldRejectRequest(URLRequest* request,
eroman 2012/06/05 05:30:25 Can this be |const URLRequest*| or |const URLReque
Jói 2012/06/05 16:39:14 Done.
36 int load_flags) const = 0;
34 37
35 // Calculates a recommended sending time for the next request and reserves it. 38 // Calculates a recommended sending time for the next request and reserves it.
36 // The sending time is not earlier than the current exponential back-off 39 // The sending time is not earlier than the current exponential back-off
37 // release time or |earliest_time|. Moreover, the previous results of 40 // release time or |earliest_time|. Moreover, the previous results of
38 // the method are taken into account, in order to make sure they are spread 41 // the method are taken into account, in order to make sure they are spread
39 // properly over time. 42 // properly over time.
40 // Returns the recommended delay before sending the next request, in 43 // Returns the recommended delay before sending the next request, in
41 // milliseconds. The return value is always positive or 0. 44 // milliseconds. The return value is always positive or 0.
42 // Although it is not mandatory, respecting the value returned by this method 45 // Although it is not mandatory, respecting the value returned by this method
43 // is helpful to avoid traffic overload. 46 // is helpful to avoid traffic overload.
(...skipping 20 matching lines...) Expand all
64 virtual ~URLRequestThrottlerEntryInterface() {} 67 virtual ~URLRequestThrottlerEntryInterface() {}
65 68
66 private: 69 private:
67 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; 70 friend class base::RefCounted<URLRequestThrottlerEntryInterface>;
68 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); 71 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface);
69 }; 72 };
70 73
71 } // namespace net 74 } // namespace net
72 75
73 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ 76 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698