| 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 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2584 if (dns_client_->GetConfig()) { | 2584 if (dns_client_->GetConfig()) { |
| 2585 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2585 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
| 2586 // If we just switched DnsClients, restart jobs using new resolver. | 2586 // If we just switched DnsClients, restart jobs using new resolver. |
| 2587 // TODO(pauljensen): Is this necessary? | 2587 // TODO(pauljensen): Is this necessary? |
| 2588 config_changed = true; | 2588 config_changed = true; |
| 2589 } | 2589 } |
| 2590 } | 2590 } |
| 2591 | 2591 |
| 2592 if (config_changed) { | 2592 if (config_changed) { |
| 2593 // If the DNS server has changed, existing cached info could be wrong so we | 2593 // If the DNS server has changed, existing cached info could be wrong so we |
| 2594 // have to drop our internal cache :( Note that OS level DNS caches, such | 2594 // have to expire our internal cache :( Note that OS level DNS caches, such |
| 2595 // as NSCD's cache should be dropped automatically by the OS when | 2595 // as NSCD's cache should be dropped automatically by the OS when |
| 2596 // resolv.conf changes so we don't need to do anything to clear that cache. | 2596 // resolv.conf changes so we don't need to do anything to clear that cache. |
| 2597 if (cache_.get()) { | 2597 if (cache_.get()) { |
| 2598 cache_->clear(); | 2598 cache_->OnNetworkChange(); |
| 2599 cache_hit_callbacks_.clear(); | 2599 cache_hit_callbacks_.clear(); |
| 2600 } | 2600 } |
| 2601 | 2601 |
| 2602 // Life check to bail once |this| is deleted. | 2602 // Life check to bail once |this| is deleted. |
| 2603 base::WeakPtr<HostResolverImpl> self = weak_ptr_factory_.GetWeakPtr(); | 2603 base::WeakPtr<HostResolverImpl> self = weak_ptr_factory_.GetWeakPtr(); |
| 2604 | 2604 |
| 2605 // Existing jobs will have been sent to the original server so they need to | 2605 // Existing jobs will have been sent to the original server so they need to |
| 2606 // be aborted. | 2606 // be aborted. |
| 2607 AbortAllInProgressJobs(); | 2607 AbortAllInProgressJobs(); |
| 2608 | 2608 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2716 if (job_) | 2716 if (job_) |
| 2717 job_->CancelRequest(this); | 2717 job_->CancelRequest(this); |
| 2718 } | 2718 } |
| 2719 | 2719 |
| 2720 void HostResolverImpl::RequestImpl::ChangeRequestPriority( | 2720 void HostResolverImpl::RequestImpl::ChangeRequestPriority( |
| 2721 RequestPriority priority) { | 2721 RequestPriority priority) { |
| 2722 job_->ChangeRequestPriority(this, priority); | 2722 job_->ChangeRequestPriority(this, priority); |
| 2723 } | 2723 } |
| 2724 | 2724 |
| 2725 } // namespace net | 2725 } // namespace net |
| OLD | NEW |