| 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); |
| 56 return resolver; | 58 return resolver; |
| 57 } | 59 } |
| 58 | 60 |
| 59 static int ResolveAddrInfo(HostResolverProc* resolver_proc, | 61 static int ResolveAddrInfo(HostResolverProc* resolver_proc, |
| 60 const std::string& host, | 62 const std::string& host, |
| 61 AddressFamily address_family, | 63 AddressFamily address_family, |
| 62 AddressList* out) { | 64 AddressList* out) { |
| 63 if (resolver_proc) { | 65 if (resolver_proc) { |
| 64 // Use the custom procedure. | 66 // Use the custom procedure. |
| 65 return resolver_proc->Resolve(host, address_family, out); | 67 return resolver_proc->Resolve(host, address_family, out); |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 if (r == req) | 981 if (r == req) |
| 980 return error; | 982 return error; |
| 981 | 983 |
| 982 r->OnComplete(error, AddressList()); | 984 r->OnComplete(error, AddressList()); |
| 983 } | 985 } |
| 984 | 986 |
| 985 return ERR_IO_PENDING; | 987 return ERR_IO_PENDING; |
| 986 } | 988 } |
| 987 | 989 |
| 988 } // namespace net | 990 } // namespace net |
| OLD | NEW |