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

Unified Diff: net/url_request/url_request_throttler_manager.cc

Issue 11620007: Switch from OnIPAddressChanged and OnConnectionTypeChange to OnNetworkChanged Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_throttler_manager.cc
diff --git a/net/url_request/url_request_throttler_manager.cc b/net/url_request/url_request_throttler_manager.cc
index fa04a00e040fc0db7f8b9737ea71d9aa5d84a40a..eb71267e9ee43c37985943b8e2b8b570bd97590f 100644
--- a/net/url_request/url_request_throttler_manager.cc
+++ b/net/url_request/url_request_throttler_manager.cc
@@ -26,13 +26,11 @@ URLRequestThrottlerManager::URLRequestThrottlerManager()
url_id_replacements_.ClearQuery();
url_id_replacements_.ClearRef();
- NetworkChangeNotifier::AddIPAddressObserver(this);
- NetworkChangeNotifier::AddConnectionTypeObserver(this);
+ NetworkChangeNotifier::AddNetworkChangeObserver(this);
}
URLRequestThrottlerManager::~URLRequestThrottlerManager() {
- NetworkChangeNotifier::RemoveIPAddressObserver(this);
- NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
+ NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
// Since the manager object might conceivably go away before the
// entries, detach the entries' back-pointer to the manager.
@@ -149,15 +147,6 @@ NetLog* URLRequestThrottlerManager::net_log() const {
return net_log_.net_log();
}
-void URLRequestThrottlerManager::OnIPAddressChanged() {
- OnNetworkChange();
-}
-
-void URLRequestThrottlerManager::OnConnectionTypeChanged(
- NetworkChangeNotifier::ConnectionType type) {
- OnNetworkChange();
-}
-
std::string URLRequestThrottlerManager::GetIdFromUrl(const GURL& url) const {
if (!url.is_valid())
return url.possibly_invalid_spec();
@@ -191,7 +180,10 @@ void URLRequestThrottlerManager::GarbageCollectEntries() {
}
}
-void URLRequestThrottlerManager::OnNetworkChange() {
+void URLRequestThrottlerManager::OnNetworkChanged(
+ NetworkChangeNotifier::ConnectionType type) {
+ if (type != NetworkChangeNotifier::CONNECTION_NONE)
+ return;
// Remove all entries. Any entries that in-flight requests have a reference
// to will live until those requests end, and these entries may be
// inconsistent with new entries for the same URLs, but since what we

Powered by Google App Engine
This is Rietveld 408576698