| 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/dns/host_resolver_impl.h" | 5 #include "net/dns/host_resolver_impl.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <Winsock2.h> | 8 #include <Winsock2.h> |
| 9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
| 10 #include <netdb.h> | 10 #include <netdb.h> |
| (...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 | 2126 |
| 2127 // TODO(szym): Remove once http://crbug.com/137914 is resolved. | 2127 // TODO(szym): Remove once http://crbug.com/137914 is resolved. |
| 2128 received_dns_config_ = dns_config.IsValid(); | 2128 received_dns_config_ = dns_config.IsValid(); |
| 2129 | 2129 |
| 2130 num_dns_failures_ = 0; | 2130 num_dns_failures_ = 0; |
| 2131 | 2131 |
| 2132 // We want a new DnsSession in place, before we Abort running Jobs, so that | 2132 // We want a new DnsSession in place, before we Abort running Jobs, so that |
| 2133 // the newly started jobs use the new config. | 2133 // the newly started jobs use the new config. |
| 2134 if (dns_client_.get()) { | 2134 if (dns_client_.get()) { |
| 2135 dns_client_->SetConfig(dns_config); | 2135 dns_client_->SetConfig(dns_config); |
| 2136 if (dns_config.IsValid()) | 2136 if (dns_client_->GetConfig()) |
| 2137 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2137 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
| 2138 } | 2138 } |
| 2139 | 2139 |
| 2140 // If the DNS server has changed, existing cached info could be wrong so we | 2140 // If the DNS server has changed, existing cached info could be wrong so we |
| 2141 // have to drop our internal cache :( Note that OS level DNS caches, such | 2141 // have to drop our internal cache :( Note that OS level DNS caches, such |
| 2142 // as NSCD's cache should be dropped automatically by the OS when | 2142 // as NSCD's cache should be dropped automatically by the OS when |
| 2143 // resolv.conf changes so we don't need to do anything to clear that cache. | 2143 // resolv.conf changes so we don't need to do anything to clear that cache. |
| 2144 if (cache_.get()) | 2144 if (cache_.get()) |
| 2145 cache_->clear(); | 2145 cache_->clear(); |
| 2146 | 2146 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 } | 2192 } |
| 2193 dns_client_ = dns_client.Pass(); | 2193 dns_client_ = dns_client.Pass(); |
| 2194 if (!dns_client_ || dns_client_->GetConfig() || | 2194 if (!dns_client_ || dns_client_->GetConfig() || |
| 2195 num_dns_failures_ >= kMaximumDnsFailures) { | 2195 num_dns_failures_ >= kMaximumDnsFailures) { |
| 2196 return; | 2196 return; |
| 2197 } | 2197 } |
| 2198 DnsConfig dns_config; | 2198 DnsConfig dns_config; |
| 2199 NetworkChangeNotifier::GetDnsConfig(&dns_config); | 2199 NetworkChangeNotifier::GetDnsConfig(&dns_config); |
| 2200 dns_client_->SetConfig(dns_config); | 2200 dns_client_->SetConfig(dns_config); |
| 2201 num_dns_failures_ = 0; | 2201 num_dns_failures_ = 0; |
| 2202 if (dns_config.IsValid()) | 2202 if (dns_client_->GetConfig()) |
| 2203 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2203 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
| 2204 } | 2204 } |
| 2205 | 2205 |
| 2206 } // namespace net | 2206 } // namespace net |
| OLD | NEW |