OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 EXTENSIONS_BROWSER_EXTENSION_THROTTLE_ENTRY_INTERFACE_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_THROTTLE_ENTRY_INTERFACE_H_ |
6 #define EXTENSIONS_BROWSER_EXTENSION_THROTTLE_ENTRY_INTERFACE_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_THROTTLE_ENTRY_INTERFACE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/basictypes.h" | 12 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
13 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
14 | 16 |
15 namespace net { | 17 namespace net { |
16 class URLRequest; | 18 class URLRequest; |
17 } // namespace net | 19 } // namespace net |
18 | 20 |
19 namespace extensions { | 21 namespace extensions { |
20 | 22 |
(...skipping 14 matching lines...) Expand all Loading... |
35 | 37 |
36 // 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. |
37 // 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 |
38 // release time or |earliest_time|. Moreover, the previous results of | 40 // release time or |earliest_time|. Moreover, the previous results of |
39 // 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 |
40 // properly over time. | 42 // properly over time. |
41 // Returns the recommended delay before sending the next request, in | 43 // Returns the recommended delay before sending the next request, in |
42 // milliseconds. The return value is always positive or 0. | 44 // milliseconds. The return value is always positive or 0. |
43 // 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 |
44 // is helpful to avoid traffic overload. | 46 // is helpful to avoid traffic overload. |
45 virtual int64 ReserveSendingTimeForNextRequest( | 47 virtual int64_t ReserveSendingTimeForNextRequest( |
46 const base::TimeTicks& earliest_time) = 0; | 48 const base::TimeTicks& earliest_time) = 0; |
47 | 49 |
48 // Returns the time after which requests are allowed. | 50 // Returns the time after which requests are allowed. |
49 virtual base::TimeTicks GetExponentialBackoffReleaseTime() const = 0; | 51 virtual base::TimeTicks GetExponentialBackoffReleaseTime() const = 0; |
50 | 52 |
51 // This method needs to be called each time a response is received. | 53 // This method needs to be called each time a response is received. |
52 virtual void UpdateWithResponse(int status_code) = 0; | 54 virtual void UpdateWithResponse(int status_code) = 0; |
53 | 55 |
54 // Lets higher-level modules, that know how to parse particular response | 56 // Lets higher-level modules, that know how to parse particular response |
55 // bodies, notify of receiving malformed content for the given URL. This will | 57 // bodies, notify of receiving malformed content for the given URL. This will |
(...skipping 11 matching lines...) Expand all Loading... |
67 virtual ~ExtensionThrottleEntryInterface() {} | 69 virtual ~ExtensionThrottleEntryInterface() {} |
68 | 70 |
69 private: | 71 private: |
70 friend class base::RefCounted<ExtensionThrottleEntryInterface>; | 72 friend class base::RefCounted<ExtensionThrottleEntryInterface>; |
71 DISALLOW_COPY_AND_ASSIGN(ExtensionThrottleEntryInterface); | 73 DISALLOW_COPY_AND_ASSIGN(ExtensionThrottleEntryInterface); |
72 }; | 74 }; |
73 | 75 |
74 } // namespace extensions | 76 } // namespace extensions |
75 | 77 |
76 #endif // EXTENSIONS_BROWSER_EXTENSION_THROTTLE_ENTRY_INTERFACE_H_ | 78 #endif // EXTENSIONS_BROWSER_EXTENSION_THROTTLE_ENTRY_INTERFACE_H_ |
OLD | NEW |