| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 kMaxHostCacheEntries, | 65 kMaxHostCacheEntries, |
| 66 base::TimeDelta::FromMinutes(1), | 66 base::TimeDelta::FromMinutes(1), |
| 67 base::TimeDelta::FromSeconds(0)); // Disable caching of failed DNS. | 67 base::TimeDelta::FromSeconds(0)); // Disable caching of failed DNS. |
| 68 | 68 |
| 69 return cache; | 69 return cache; |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // anonymous namespace | 72 } // anonymous namespace |
| 73 | 73 |
| 74 HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves, | 74 HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves, |
| 75 HostResolverProc* resolver_proc, | |
| 76 NetLog* net_log) { | 75 NetLog* net_log) { |
| 77 // Maximum of 50 concurrent threads. | 76 // Maximum of 50 concurrent threads. |
| 78 // TODO(eroman): Adjust this, do some A/B experiments. | 77 // TODO(eroman): Adjust this, do some A/B experiments. |
| 79 static const size_t kDefaultMaxJobs = 50u; | 78 static const size_t kDefaultMaxJobs = 50u; |
| 80 | 79 |
| 81 if (max_concurrent_resolves == HostResolver::kDefaultParallelism) | 80 if (max_concurrent_resolves == HostResolver::kDefaultParallelism) |
| 82 max_concurrent_resolves = kDefaultMaxJobs; | 81 max_concurrent_resolves = kDefaultMaxJobs; |
| 83 | 82 |
| 84 HostResolverImpl* resolver = | 83 HostResolverImpl* resolver = |
| 85 new HostResolverImpl(resolver_proc, CreateDefaultCache(), | 84 new HostResolverImpl(NULL, CreateDefaultCache(), |
| 86 max_concurrent_resolves, net_log); | 85 max_concurrent_resolves, net_log); |
| 87 | 86 |
| 88 return resolver; | 87 return resolver; |
| 89 } | 88 } |
| 90 | 89 |
| 91 static int ResolveAddrInfo(HostResolverProc* resolver_proc, | 90 static int ResolveAddrInfo(HostResolverProc* resolver_proc, |
| 92 const std::string& host, | 91 const std::string& host, |
| 93 AddressFamily address_family, | 92 AddressFamily address_family, |
| 94 HostResolverFlags host_resolver_flags, | 93 HostResolverFlags host_resolver_flags, |
| 95 AddressList* out, | 94 AddressList* out, |
| (...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 job_pools_[i]->ResetNumOutstandingJobs(); | 1441 job_pools_[i]->ResetNumOutstandingJobs(); |
| 1443 JobMap jobs; | 1442 JobMap jobs; |
| 1444 jobs.swap(jobs_); | 1443 jobs.swap(jobs_); |
| 1445 for (JobMap::iterator it = jobs.begin(); it != jobs.end(); ++it) { | 1444 for (JobMap::iterator it = jobs.begin(); it != jobs.end(); ++it) { |
| 1446 AbortJob(it->second); | 1445 AbortJob(it->second); |
| 1447 it->second->Cancel(); | 1446 it->second->Cancel(); |
| 1448 } | 1447 } |
| 1449 } | 1448 } |
| 1450 | 1449 |
| 1451 } // namespace net | 1450 } // namespace net |
| OLD | NEW |