OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 8 |
8 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
9 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
10 #include "base/time.h" | 11 #include "base/time.h" |
11 | 12 |
12 namespace net { | 13 namespace net { |
13 | 14 |
14 class URLRequestThrottlerHeaderInterface; | 15 class URLRequestThrottlerHeaderInterface; |
15 | 16 |
16 // Interface provided on entries of the URL request throttler manager. | 17 // Interface provided on entries of the URL request throttler manager. |
(...skipping 26 matching lines...) Expand all Loading... |
43 // This method needs to be called each time a response is received. | 44 // This method needs to be called each time a response is received. |
44 virtual void UpdateWithResponse( | 45 virtual void UpdateWithResponse( |
45 const URLRequestThrottlerHeaderInterface* response) = 0; | 46 const URLRequestThrottlerHeaderInterface* response) = 0; |
46 | 47 |
47 // Lets higher-level modules, that know how to parse particular response | 48 // Lets higher-level modules, that know how to parse particular response |
48 // bodies, notify of receiving malformed content for the given URL. This will | 49 // bodies, notify of receiving malformed content for the given URL. This will |
49 // be handled by the throttler as if an HTTP 5xx response had been received to | 50 // be handled by the throttler as if an HTTP 5xx response had been received to |
50 // the request, i.e. it will count as a failure. | 51 // the request, i.e. it will count as a failure. |
51 virtual void ReceivedContentWasMalformed() = 0; | 52 virtual void ReceivedContentWasMalformed() = 0; |
52 | 53 |
53 // For unit testing only. | |
54 virtual void SetEntryLifetimeMsForTest(int lifetime_ms) = 0; | |
55 | |
56 protected: | 54 protected: |
57 friend class base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface>; | 55 friend class base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface>; |
58 virtual ~URLRequestThrottlerEntryInterface() {} | 56 virtual ~URLRequestThrottlerEntryInterface() {} |
59 | 57 |
60 private: | 58 private: |
61 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; | 59 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; |
62 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); | 60 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); |
63 }; | 61 }; |
64 | 62 |
65 } // namespace net | 63 } // namespace net |
66 | 64 |
67 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ | 65 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ |
OLD | NEW |