| OLD | NEW |
| 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 #include "net/base/network_change_notifier.h" | 5 #include "net/base/network_change_notifier.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 | 942 |
| 943 // static | 943 // static |
| 944 void NetworkChangeNotifier::SetDnsConfig(const DnsConfig& config) { | 944 void NetworkChangeNotifier::SetDnsConfig(const DnsConfig& config) { |
| 945 if (!g_network_change_notifier) | 945 if (!g_network_change_notifier) |
| 946 return; | 946 return; |
| 947 g_network_change_notifier->network_state_->SetDnsConfig(config); | 947 g_network_change_notifier->network_state_->SetDnsConfig(config); |
| 948 NotifyObserversOfDNSChange(); | 948 NotifyObserversOfDNSChange(); |
| 949 } | 949 } |
| 950 | 950 |
| 951 void NetworkChangeNotifier::NotifyObserversOfIPAddressChangeImpl() { | 951 void NetworkChangeNotifier::NotifyObserversOfIPAddressChangeImpl() { |
| 952 ip_address_observer_list_->Notify(&IPAddressObserver::OnIPAddressChanged); | 952 ip_address_observer_list_->Notify(FROM_HERE, |
| 953 &IPAddressObserver::OnIPAddressChanged); |
| 953 } | 954 } |
| 954 | 955 |
| 955 void NetworkChangeNotifier::NotifyObserversOfConnectionTypeChangeImpl( | 956 void NetworkChangeNotifier::NotifyObserversOfConnectionTypeChangeImpl( |
| 956 ConnectionType type) { | 957 ConnectionType type) { |
| 957 connection_type_observer_list_->Notify( | 958 connection_type_observer_list_->Notify( |
| 958 &ConnectionTypeObserver::OnConnectionTypeChanged, type); | 959 FROM_HERE, &ConnectionTypeObserver::OnConnectionTypeChanged, type); |
| 959 } | 960 } |
| 960 | 961 |
| 961 void NetworkChangeNotifier::NotifyObserversOfNetworkChangeImpl( | 962 void NetworkChangeNotifier::NotifyObserversOfNetworkChangeImpl( |
| 962 ConnectionType type) { | 963 ConnectionType type) { |
| 963 network_change_observer_list_->Notify( | 964 network_change_observer_list_->Notify( |
| 964 &NetworkChangeObserver::OnNetworkChanged, type); | 965 FROM_HERE, &NetworkChangeObserver::OnNetworkChanged, type); |
| 965 } | 966 } |
| 966 | 967 |
| 967 void NetworkChangeNotifier::NotifyObserversOfDNSChangeImpl() { | 968 void NetworkChangeNotifier::NotifyObserversOfDNSChangeImpl() { |
| 968 resolver_state_observer_list_->Notify(&DNSObserver::OnDNSChanged); | 969 resolver_state_observer_list_->Notify(FROM_HERE, &DNSObserver::OnDNSChanged); |
| 969 } | 970 } |
| 970 | 971 |
| 971 void NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChangeImpl( | 972 void NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChangeImpl( |
| 972 double max_bandwidth_mbps) { | 973 double max_bandwidth_mbps) { |
| 973 max_bandwidth_observer_list_->Notify( | 974 max_bandwidth_observer_list_->Notify( |
| 974 &MaxBandwidthObserver::OnMaxBandwidthChanged, max_bandwidth_mbps); | 975 FROM_HERE, &MaxBandwidthObserver::OnMaxBandwidthChanged, |
| 976 max_bandwidth_mbps); |
| 975 } | 977 } |
| 976 | 978 |
| 977 NetworkChangeNotifier::DisableForTest::DisableForTest() | 979 NetworkChangeNotifier::DisableForTest::DisableForTest() |
| 978 : network_change_notifier_(g_network_change_notifier) { | 980 : network_change_notifier_(g_network_change_notifier) { |
| 979 DCHECK(g_network_change_notifier); | 981 DCHECK(g_network_change_notifier); |
| 980 g_network_change_notifier = NULL; | 982 g_network_change_notifier = NULL; |
| 981 } | 983 } |
| 982 | 984 |
| 983 NetworkChangeNotifier::DisableForTest::~DisableForTest() { | 985 NetworkChangeNotifier::DisableForTest::~DisableForTest() { |
| 984 DCHECK(!g_network_change_notifier); | 986 DCHECK(!g_network_change_notifier); |
| 985 g_network_change_notifier = network_change_notifier_; | 987 g_network_change_notifier = network_change_notifier_; |
| 986 } | 988 } |
| 987 | 989 |
| 988 } // namespace net | 990 } // namespace net |
| OLD | NEW |