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

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

Issue 5364003: Make URLRequestThrottlerEntryInterface inherit RefCountedThreadSafe, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add friend. Created 10 years 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
« no previous file with comments | « no previous file | tools/valgrind/tsan/suppressions.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 class URLRequestThrottlerHeaderInterface; 14 class URLRequestThrottlerHeaderInterface;
15 15
16 // Interface provided on entries of the URL request throttler manager. 16 // Interface provided on entries of the URL request throttler manager.
17 class URLRequestThrottlerEntryInterface 17 class URLRequestThrottlerEntryInterface
18 : public base::RefCounted<URLRequestThrottlerEntryInterface> { 18 : public base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface> {
19 public: 19 public:
20 URLRequestThrottlerEntryInterface() {} 20 URLRequestThrottlerEntryInterface() {}
21 21
22 // Returns true when we have encountered server errors and are doing 22 // Returns true when we have encountered server errors and are doing
23 // exponential back-off. 23 // exponential back-off.
24 // URLRequestHttpJob checks this method prior to every request; it cancels 24 // URLRequestHttpJob checks this method prior to every request; it cancels
25 // requests if this method returns true. 25 // requests if this method returns true.
26 virtual bool IsDuringExponentialBackoff() const = 0; 26 virtual bool IsDuringExponentialBackoff() const = 0;
27 27
28 // Calculates a recommended sending time for the next request and reserves it. 28 // Calculates a recommended sending time for the next request and reserves it.
(...skipping 15 matching lines...) Expand all
44 virtual void UpdateWithResponse( 44 virtual void UpdateWithResponse(
45 const URLRequestThrottlerHeaderInterface* response) = 0; 45 const URLRequestThrottlerHeaderInterface* response) = 0;
46 46
47 // Lets higher-level modules, that know how to parse particular response 47 // Lets higher-level modules, that know how to parse particular response
48 // bodies, notify of receiving malformed content for the given URL. This will 48 // 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 49 // 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. 50 // the request, i.e. it will count as a failure.
51 virtual void ReceivedContentWasMalformed() = 0; 51 virtual void ReceivedContentWasMalformed() = 0;
52 52
53 protected: 53 protected:
54 friend class base::RefCountedThreadSafe<URLRequestThrottlerEntryInterface>;
54 virtual ~URLRequestThrottlerEntryInterface() {} 55 virtual ~URLRequestThrottlerEntryInterface() {}
55 56
56 private: 57 private:
57 friend class base::RefCounted<URLRequestThrottlerEntryInterface>; 58 friend class base::RefCounted<URLRequestThrottlerEntryInterface>;
58 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface); 59 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerEntryInterface);
59 }; 60 };
60 61
61 } // namespace net 62 } // namespace net
62 63
63 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_ 64 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_ENTRY_INTERFACE_H_
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/tsan/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698