| 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 NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // collected. | 86 // collected. |
| 87 bool IsEntryOutdated() const; | 87 bool IsEntryOutdated() const; |
| 88 | 88 |
| 89 // Causes this entry to never reject requests due to back-off. | 89 // Causes this entry to never reject requests due to back-off. |
| 90 void DisableBackoffThrottling(); | 90 void DisableBackoffThrottling(); |
| 91 | 91 |
| 92 // Causes this entry to NULL its manager pointer. | 92 // Causes this entry to NULL its manager pointer. |
| 93 void DetachManager(); | 93 void DetachManager(); |
| 94 | 94 |
| 95 // Implementation of URLRequestThrottlerEntryInterface. | 95 // Implementation of URLRequestThrottlerEntryInterface. |
| 96 virtual bool ShouldRejectRequest( | 96 bool ShouldRejectRequest(const URLRequest& request, |
| 97 const URLRequest& request, | 97 NetworkDelegate* network_delegate) const override; |
| 98 NetworkDelegate* network_delegate) const override; | 98 int64 ReserveSendingTimeForNextRequest( |
| 99 virtual int64 ReserveSendingTimeForNextRequest( | |
| 100 const base::TimeTicks& earliest_time) override; | 99 const base::TimeTicks& earliest_time) override; |
| 101 virtual base::TimeTicks GetExponentialBackoffReleaseTime() const override; | 100 base::TimeTicks GetExponentialBackoffReleaseTime() const override; |
| 102 virtual void UpdateWithResponse( | 101 void UpdateWithResponse( |
| 103 const std::string& host, | 102 const std::string& host, |
| 104 const URLRequestThrottlerHeaderInterface* response) override; | 103 const URLRequestThrottlerHeaderInterface* response) override; |
| 105 virtual void ReceivedContentWasMalformed(int response_code) override; | 104 void ReceivedContentWasMalformed(int response_code) override; |
| 106 | 105 |
| 107 protected: | 106 protected: |
| 108 virtual ~URLRequestThrottlerEntry(); | 107 ~URLRequestThrottlerEntry() override; |
| 109 | 108 |
| 110 void Initialize(); | 109 void Initialize(); |
| 111 | 110 |
| 112 // Returns true if the given response code is considered an error for | 111 // Returns true if the given response code is considered an error for |
| 113 // throttling purposes. | 112 // throttling purposes. |
| 114 bool IsConsideredError(int response_code); | 113 bool IsConsideredError(int response_code); |
| 115 | 114 |
| 116 // Equivalent to TimeTicks::Now(), virtual to be mockable for testing purpose. | 115 // Equivalent to TimeTicks::Now(), virtual to be mockable for testing purpose. |
| 117 virtual base::TimeTicks ImplGetTimeNow() const; | 116 virtual base::TimeTicks ImplGetTimeNow() const; |
| 118 | 117 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 std::string url_id_; | 168 std::string url_id_; |
| 170 | 169 |
| 171 BoundNetLog net_log_; | 170 BoundNetLog net_log_; |
| 172 | 171 |
| 173 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntry); | 172 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntry); |
| 174 }; | 173 }; |
| 175 | 174 |
| 176 } // namespace net | 175 } // namespace net |
| 177 | 176 |
| 178 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ | 177 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_H_ |
| OLD | NEW |