| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <cmath> | 7 #include <cmath> |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 HostResolver* CreateSystemHostResolver( | 46 HostResolver* CreateSystemHostResolver( |
| 47 NetworkChangeNotifier* network_change_notifier) { | 47 NetworkChangeNotifier* network_change_notifier) { |
| 48 // Maximum of 50 concurrent threads. | 48 // Maximum of 50 concurrent threads. |
| 49 // TODO(eroman): Adjust this, do some A/B experiments. | 49 // TODO(eroman): Adjust this, do some A/B experiments. |
| 50 static const size_t kMaxJobs = 50u; | 50 static const size_t kMaxJobs = 50u; |
| 51 | 51 |
| 52 // TODO(willchan): Pass in the NetworkChangeNotifier. | 52 // TODO(willchan): Pass in the NetworkChangeNotifier. |
| 53 HostResolverImpl* resolver = new HostResolverImpl( | 53 HostResolverImpl* resolver = new HostResolverImpl( |
| 54 NULL, CreateDefaultCache(), network_change_notifier, kMaxJobs); | 54 NULL, CreateDefaultCache(), network_change_notifier, kMaxJobs); |
| 55 | 55 |
| 56 if (!HostResolverProc::IPv6Supported()) | |
| 57 resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | |
| 58 return resolver; | 56 return resolver; |
| 59 } | 57 } |
| 60 | 58 |
| 61 static int ResolveAddrInfo(HostResolverProc* resolver_proc, | 59 static int ResolveAddrInfo(HostResolverProc* resolver_proc, |
| 62 const std::string& host, | 60 const std::string& host, |
| 63 AddressFamily address_family, | 61 AddressFamily address_family, |
| 64 AddressList* out) { | 62 AddressList* out) { |
| 65 if (resolver_proc) { | 63 if (resolver_proc) { |
| 66 // Use the custom procedure. | 64 // Use the custom procedure. |
| 67 return resolver_proc->Resolve(host, address_family, out); | 65 return resolver_proc->Resolve(host, address_family, out); |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 if (r == req) | 979 if (r == req) |
| 982 return error; | 980 return error; |
| 983 | 981 |
| 984 r->OnComplete(error, AddressList()); | 982 r->OnComplete(error, AddressList()); |
| 985 } | 983 } |
| 986 | 984 |
| 987 return ERR_IO_PENDING; | 985 return ERR_IO_PENDING; |
| 988 } | 986 } |
| 989 | 987 |
| 990 } // namespace net | 988 } // namespace net |
| OLD | NEW |