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

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

Issue 9147026: API for connection type (Ethernet/WIFI/WWAN ...) in NetworkChangeNotifier. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed a typo Created 8 years, 7 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
OLDNEW
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_MANAGER_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_
6 #define NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 18 matching lines...) Expand all
29 // register their URLs in this manager on each request. 29 // register their URLs in this manager on each request.
30 // 30 //
31 // URLRequestThrottlerManager maintains a map of URL IDs to URL request 31 // URLRequestThrottlerManager maintains a map of URL IDs to URL request
32 // throttler entries. It creates URL request throttler entries when new URLs 32 // throttler entries. It creates URL request throttler entries when new URLs
33 // are registered, and does garbage collection from time to time in order to 33 // are registered, and does garbage collection from time to time in order to
34 // clean out outdated entries. URL ID consists of lowercased scheme, host, port 34 // clean out outdated entries. URL ID consists of lowercased scheme, host, port
35 // and path. All URLs converted to the same ID will share the same entry. 35 // and path. All URLs converted to the same ID will share the same entry.
36 class NET_EXPORT URLRequestThrottlerManager 36 class NET_EXPORT URLRequestThrottlerManager
37 : NON_EXPORTED_BASE(public base::NonThreadSafe), 37 : NON_EXPORTED_BASE(public base::NonThreadSafe),
38 public NetworkChangeNotifier::IPAddressObserver, 38 public NetworkChangeNotifier::IPAddressObserver,
39 public NetworkChangeNotifier::OnlineStateObserver { 39 public NetworkChangeNotifier::ConnectionTypeObserver {
40 public: 40 public:
41 URLRequestThrottlerManager(); 41 URLRequestThrottlerManager();
42 virtual ~URLRequestThrottlerManager(); 42 virtual ~URLRequestThrottlerManager();
43 43
44 // Must be called for every request, returns the URL request throttler entry 44 // Must be called for every request, returns the URL request throttler entry
45 // associated with the URL. The caller must inform this entry of some events. 45 // associated with the URL. The caller must inform this entry of some events.
46 // Please refer to url_request_throttler_entry_interface.h for further 46 // Please refer to url_request_throttler_entry_interface.h for further
47 // informations. 47 // informations.
48 scoped_refptr<URLRequestThrottlerEntryInterface> RegisterRequestUrl( 48 scoped_refptr<URLRequestThrottlerEntryInterface> RegisterRequestUrl(
49 const GURL& url); 49 const GURL& url);
(...skipping 24 matching lines...) Expand all
74 void set_enforce_throttling(bool enforce); 74 void set_enforce_throttling(bool enforce);
75 bool enforce_throttling(); 75 bool enforce_throttling();
76 76
77 // Sets the NetLog instance to use. 77 // Sets the NetLog instance to use.
78 void set_net_log(NetLog* net_log); 78 void set_net_log(NetLog* net_log);
79 NetLog* net_log() const; 79 NetLog* net_log() const;
80 80
81 // IPAddressObserver interface. 81 // IPAddressObserver interface.
82 virtual void OnIPAddressChanged() OVERRIDE; 82 virtual void OnIPAddressChanged() OVERRIDE;
83 83
84 // OnlineStateObserver interface. 84 // ConnectionTypeObserver interface.
85 virtual void OnOnlineStateChanged(bool online) OVERRIDE; 85 virtual void OnConnectionTypeChanged(
86 NetworkChangeNotifier::ConnectionType type) OVERRIDE;
86 87
87 // Method that allows us to transform a URL into an ID that can be used in our 88 // Method that allows us to transform a URL into an ID that can be used in our
88 // map. Resulting IDs will be lowercase and consist of the scheme, host, port 89 // map. Resulting IDs will be lowercase and consist of the scheme, host, port
89 // and path (without query string, fragment, etc.). 90 // and path (without query string, fragment, etc.).
90 // If the URL is invalid, the invalid spec will be returned, without any 91 // If the URL is invalid, the invalid spec will be returned, without any
91 // transformation. 92 // transformation.
92 std::string GetIdFromUrl(const GURL& url) const; 93 std::string GetIdFromUrl(const GURL& url) const;
93 94
94 // Method that ensures the map gets cleaned from time to time. The period at 95 // Method that ensures the map gets cleaned from time to time. The period at
95 // which garbage collecting happens is adjustable with the 96 // which garbage collecting happens is adjustable with the
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 162
162 // Valid once we've registered for network notifications. 163 // Valid once we've registered for network notifications.
163 base::PlatformThreadId registered_from_thread_; 164 base::PlatformThreadId registered_from_thread_;
164 165
165 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager); 166 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager);
166 }; 167 };
167 168
168 } // namespace net 169 } // namespace net
169 170
170 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_ 171 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_
OLDNEW
« no previous file with comments | « net/base/network_change_notifier_win_unittest.cc ('k') | net/url_request/url_request_throttler_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698