| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/host_resolver_impl.h" | 5 #include "net/base/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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 // so we choose some defaults, which users can override later. | 916 // so we choose some defaults, which users can override later. |
| 917 job_pools_[POOL_NORMAL] = new JobPool(max_jobs, 100u * max_jobs); | 917 job_pools_[POOL_NORMAL] = new JobPool(max_jobs, 100u * max_jobs); |
| 918 | 918 |
| 919 #if defined(OS_WIN) | 919 #if defined(OS_WIN) |
| 920 EnsureWinsockInit(); | 920 EnsureWinsockInit(); |
| 921 #endif | 921 #endif |
| 922 #if defined(OS_LINUX) | 922 #if defined(OS_LINUX) |
| 923 if (HaveOnlyLoopbackAddresses()) | 923 if (HaveOnlyLoopbackAddresses()) |
| 924 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; | 924 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; |
| 925 #endif | 925 #endif |
| 926 NetworkChangeNotifier::AddObserver(this); | 926 NetworkChangeNotifier::AddIPAddressObserver(this); |
| 927 } | 927 } |
| 928 | 928 |
| 929 HostResolverImpl::~HostResolverImpl() { | 929 HostResolverImpl::~HostResolverImpl() { |
| 930 // Cancel the outstanding jobs. Those jobs may contain several attached | 930 // Cancel the outstanding jobs. Those jobs may contain several attached |
| 931 // requests, which will also be cancelled. | 931 // requests, which will also be cancelled. |
| 932 DiscardIPv6ProbeJob(); | 932 DiscardIPv6ProbeJob(); |
| 933 | 933 |
| 934 CancelAllJobs(); | 934 CancelAllJobs(); |
| 935 | 935 |
| 936 // In case we are being deleted during the processing of a callback. | 936 // In case we are being deleted during the processing of a callback. |
| 937 if (cur_completing_job_) | 937 if (cur_completing_job_) |
| 938 cur_completing_job_->Cancel(); | 938 cur_completing_job_->Cancel(); |
| 939 | 939 |
| 940 NetworkChangeNotifier::RemoveObserver(this); | 940 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| 941 | 941 |
| 942 // Delete the job pools. | 942 // Delete the job pools. |
| 943 for (size_t i = 0u; i < arraysize(job_pools_); ++i) | 943 for (size_t i = 0u; i < arraysize(job_pools_); ++i) |
| 944 delete job_pools_[i]; | 944 delete job_pools_[i]; |
| 945 } | 945 } |
| 946 | 946 |
| 947 void HostResolverImpl::ProbeIPv6Support() { | 947 void HostResolverImpl::ProbeIPv6Support() { |
| 948 DCHECK(CalledOnValidThread()); | 948 DCHECK(CalledOnValidThread()); |
| 949 DCHECK(!ipv6_probe_monitoring_); | 949 DCHECK(!ipv6_probe_monitoring_); |
| 950 ipv6_probe_monitoring_ = true; | 950 ipv6_probe_monitoring_ = true; |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; | 1452 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; |
| 1453 } else { | 1453 } else { |
| 1454 additional_resolver_flags_ &= ~HOST_RESOLVER_LOOPBACK_ONLY; | 1454 additional_resolver_flags_ &= ~HOST_RESOLVER_LOOPBACK_ONLY; |
| 1455 } | 1455 } |
| 1456 #endif | 1456 #endif |
| 1457 AbortAllInProgressJobs(); | 1457 AbortAllInProgressJobs(); |
| 1458 // |this| may be deleted inside AbortAllInProgressJobs(). | 1458 // |this| may be deleted inside AbortAllInProgressJobs(). |
| 1459 } | 1459 } |
| 1460 | 1460 |
| 1461 } // namespace net | 1461 } // namespace net |
| OLD | NEW |