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

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: Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 23 matching lines...) Expand all
34 // are registered, and does garbage collection from time to time in order to 34 // are registered, and does garbage collection from time to time in order to
35 // clean out outdated entries. URL ID consists of lowercased scheme, host, port 35 // clean out outdated entries. URL ID consists of lowercased scheme, host, port
36 // and path. All URLs converted to the same ID will share the same entry. 36 // and path. All URLs converted to the same ID will share the same entry.
37 // 37 //
38 // NOTE: All usage of this singleton object must be on the same thread, 38 // NOTE: All usage of this singleton object must be on the same thread,
39 // although to allow it to be used as a singleton, construction and destruction 39 // although to allow it to be used as a singleton, construction and destruction
40 // can occur on a separate thread. 40 // can occur on a separate thread.
41 class NET_EXPORT URLRequestThrottlerManager 41 class NET_EXPORT URLRequestThrottlerManager
42 : NON_EXPORTED_BASE(public base::NonThreadSafe), 42 : NON_EXPORTED_BASE(public base::NonThreadSafe),
43 public NetworkChangeNotifier::IPAddressObserver, 43 public NetworkChangeNotifier::IPAddressObserver,
44 public NetworkChangeNotifier::OnlineStateObserver { 44 public NetworkChangeNotifier::ConnectionStateObserver {
45 public: 45 public:
46 static URLRequestThrottlerManager* GetInstance(); 46 static URLRequestThrottlerManager* GetInstance();
47 47
48 // Must be called for every request, returns the URL request throttler entry 48 // Must be called for every request, returns the URL request throttler entry
49 // associated with the URL. The caller must inform this entry of some events. 49 // associated with the URL. The caller must inform this entry of some events.
50 // Please refer to url_request_throttler_entry_interface.h for further 50 // Please refer to url_request_throttler_entry_interface.h for further
51 // informations. 51 // informations.
52 scoped_refptr<URLRequestThrottlerEntryInterface> RegisterRequestUrl( 52 scoped_refptr<URLRequestThrottlerEntryInterface> RegisterRequestUrl(
53 const GURL& url); 53 const GURL& url);
54 54
(...skipping 24 matching lines...) Expand all
79 bool enforce_throttling(); 79 bool enforce_throttling();
80 80
81 // Sets the NetLog instance to use. 81 // Sets the NetLog instance to use.
82 void set_net_log(NetLog* net_log); 82 void set_net_log(NetLog* net_log);
83 NetLog* net_log() const; 83 NetLog* net_log() const;
84 84
85 // IPAddressObserver interface. 85 // IPAddressObserver interface.
86 virtual void OnIPAddressChanged() OVERRIDE; 86 virtual void OnIPAddressChanged() OVERRIDE;
87 87
88 // OnlineStateObserver interface. 88 // OnlineStateObserver interface.
89 virtual void OnOnlineStateChanged(bool online) OVERRIDE; 89 virtual void OnConnectionStateChanged(
90 NetworkChangeNotifier::ConnectionState state) OVERRIDE;
90 91
91 protected: 92 protected:
92 URLRequestThrottlerManager(); 93 URLRequestThrottlerManager();
93 virtual ~URLRequestThrottlerManager(); 94 virtual ~URLRequestThrottlerManager();
94 95
95 // Method that allows us to transform a URL into an ID that can be used in our 96 // Method that allows us to transform a URL into an ID that can be used in our
96 // map. Resulting IDs will be lowercase and consist of the scheme, host, port 97 // map. Resulting IDs will be lowercase and consist of the scheme, host, port
97 // and path (without query string, fragment, etc.). 98 // and path (without query string, fragment, etc.).
98 // If the URL is invalid, the invalid spec will be returned, without any 99 // If the URL is invalid, the invalid spec will be returned, without any
99 // transformation. 100 // transformation.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 172
172 // Valid once we've registered for network notifications. 173 // Valid once we've registered for network notifications.
173 base::PlatformThreadId registered_from_thread_; 174 base::PlatformThreadId registered_from_thread_;
174 175
175 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager); 176 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager);
176 }; 177 };
177 178
178 } // namespace net 179 } // namespace net
179 180
180 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_ 181 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698