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

Unified Diff: net/base/network_change_notifier.cc

Issue 1047103002: Avoid initial NetworkChangeNotifier OnDNSChanged() signal on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert an accidental test enabling Created 5 years, 8 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
« no previous file with comments | « net/base/network_change_notifier.h ('k') | net/dns/dns_config_service_posix.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier.cc
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
index 3ec6369fc47019b1e0933d0938c7e0d40d8edfe8..86bc2539e6078a6db369b022981988f83b5c9ff6 100644
--- a/net/base/network_change_notifier.cc
+++ b/net/base/network_change_notifier.cc
@@ -776,6 +776,12 @@ void NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests(
}
// static
+void NetworkChangeNotifier::NotifyObserversOfInitialDNSConfigReadForTests() {
+ if (g_network_change_notifier)
+ g_network_change_notifier->NotifyObserversOfInitialDNSConfigReadImpl();
+}
+
+// static
void NetworkChangeNotifier::SetTestNotificationsOnly(bool test_only) {
if (g_network_change_notifier)
g_network_change_notifier->test_notifications_only_ = test_only;
@@ -941,6 +947,14 @@ void NetworkChangeNotifier::NotifyObserversOfDNSChange() {
}
// static
+void NetworkChangeNotifier::NotifyObserversOfInitialDNSConfigRead() {
+ if (g_network_change_notifier &&
+ !g_network_change_notifier->test_notifications_only_) {
+ g_network_change_notifier->NotifyObserversOfInitialDNSConfigReadImpl();
+ }
+}
+
+// static
void NetworkChangeNotifier::SetDnsConfig(const DnsConfig& config) {
if (!g_network_change_notifier)
return;
@@ -948,6 +962,20 @@ void NetworkChangeNotifier::SetDnsConfig(const DnsConfig& config) {
NotifyObserversOfDNSChange();
}
+// static
+void NetworkChangeNotifier::SetInitialDnsConfig(const DnsConfig& config) {
+ if (!g_network_change_notifier)
+ return;
+#if DCHECK_IS_ON()
+ // Verify we've never received a valid DnsConfig previously.
+ DnsConfig old_config;
+ g_network_change_notifier->network_state_->GetDnsConfig(&old_config);
+ DCHECK(!old_config.IsValid());
+#endif
+ g_network_change_notifier->network_state_->SetDnsConfig(config);
+ NotifyObserversOfInitialDNSConfigRead();
+}
+
void NetworkChangeNotifier::NotifyObserversOfIPAddressChangeImpl() {
ip_address_observer_list_->Notify(FROM_HERE,
&IPAddressObserver::OnIPAddressChanged);
@@ -969,6 +997,11 @@ void NetworkChangeNotifier::NotifyObserversOfDNSChangeImpl() {
resolver_state_observer_list_->Notify(FROM_HERE, &DNSObserver::OnDNSChanged);
}
+void NetworkChangeNotifier::NotifyObserversOfInitialDNSConfigReadImpl() {
+ resolver_state_observer_list_->Notify(FROM_HERE,
+ &DNSObserver::OnInitialDNSConfigRead);
+}
+
void NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChangeImpl(
double max_bandwidth_mbps) {
max_bandwidth_observer_list_->Notify(
@@ -987,4 +1020,7 @@ NetworkChangeNotifier::DisableForTest::~DisableForTest() {
g_network_change_notifier = network_change_notifier_;
}
+void NetworkChangeNotifier::DNSObserver::OnInitialDNSConfigRead() {
+}
+
} // namespace net
« no previous file with comments | « net/base/network_change_notifier.h ('k') | net/dns/dns_config_service_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698