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

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

Issue 7582004: Add load flag indicating a request is probably the result of a user gesture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to lkgr. Created 9 years, 4 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_api.h" 14 #include "net/base/net_api.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 class URLRequestThrottlerHeaderInterface; 18 class URLRequestThrottlerHeaderInterface;
19 19
20 // Interface provided on entries of the URL request throttler manager. 20 // Interface provided on entries of the URL request throttler manager.
21 class NET_API URLRequestThrottlerEntryInterface 21 class NET_API URLRequestThrottlerEntryInterface
22 : public base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface> { 22 : public base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface> {
23 public: 23 public:
24 URLRequestThrottlerEntryInterface() {} 24 URLRequestThrottlerEntryInterface() {}
25 25
26 // Returns true when we have encountered server errors and are doing 26 // Returns true when we have encountered server errors and are doing
27 // exponential back-off. 27 // exponential back-off, unless the request has |load_flags| (from
28 // net/base/load_flags.h) that mean it is likely to be
29 // user-initiated.
30 //
28 // URLRequestHttpJob checks this method prior to every request; it 31 // URLRequestHttpJob checks this method prior to every request; it
29 // cancels requests if this method returns true. 32 // cancels requests if this method returns true.
30 virtual bool IsDuringExponentialBackoff() const = 0; 33 virtual bool ShouldRejectRequest(int load_flags) const = 0;
31 34
32 // Calculates a recommended sending time for the next request and reserves it. 35 // Calculates a recommended sending time for the next request and reserves it.
33 // The sending time is not earlier than the current exponential back-off 36 // The sending time is not earlier than the current exponential back-off
34 // release time or |earliest_time|. Moreover, the previous results of 37 // release time or |earliest_time|. Moreover, the previous results of
35 // the method are taken into account, in order to make sure they are spread 38 // the method are taken into account, in order to make sure they are spread
36 // properly over time. 39 // properly over time.
37 // Returns the recommended delay before sending the next request, in 40 // Returns the recommended delay before sending the next request, in
38 // milliseconds. The return value is always positive or 0. 41 // milliseconds. The return value is always positive or 0.
39 // Although it is not mandatory, respecting the value returned by this method 42 // Although it is not mandatory, respecting the value returned by this method
40 // is helpful to avoid traffic overload. 43 // is helpful to avoid traffic overload.
(...skipping 20 matching lines...) Expand all
61 virtual ~URLRequestThrottlerEntryInterface() {} 64 virtual ~URLRequestThrottlerEntryInterface() {}
62 65
63 private: 66 private:
64 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; 67 friend class base::RefCounted<URLRequestThrottlerEntryInterface>;
65 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); 68 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface);
66 }; 69 };
67 70
68 } // namespace net 71 } // namespace net
69 72
70 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ 73 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request_throttler_entry.cc ('k') | net/url_request/url_request_throttler_simulation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698