Chromium Code Reviews| 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, | |
|
eroman
2011/01/10 20:13:45
This change doesn't make sense to me.
The "Create
| |
| 75 NetLog* net_log) { | 76 NetLog* net_log) { |
| 76 // Maximum of 50 concurrent threads. | 77 // Maximum of 50 concurrent threads. |
| 77 // TODO(eroman): Adjust this, do some A/B experiments. | 78 // TODO(eroman): Adjust this, do some A/B experiments. |
| 78 static const size_t kDefaultMaxJobs = 50u; | 79 static const size_t kDefaultMaxJobs = 50u; |
| 79 | 80 |
| 80 if (max_concurrent_resolves == HostResolver::kDefaultParallelism) | 81 if (max_concurrent_resolves == HostResolver::kDefaultParallelism) |
| 81 max_concurrent_resolves = kDefaultMaxJobs; | 82 max_concurrent_resolves = kDefaultMaxJobs; |
| 82 | 83 |
| 83 HostResolverImpl* resolver = | 84 HostResolverImpl* resolver = |
| 84 new HostResolverImpl(NULL, CreateDefaultCache(), | 85 new HostResolverImpl(resolver_proc, CreateDefaultCache(), |
| 85 max_concurrent_resolves, net_log); | 86 max_concurrent_resolves, net_log); |
| 86 | 87 |
| 87 return resolver; | 88 return resolver; |
| 88 } | 89 } |
| 89 | 90 |
| 90 static int ResolveAddrInfo(HostResolverProc* resolver_proc, | 91 static int ResolveAddrInfo(HostResolverProc* resolver_proc, |
| 91 const std::string& host, | 92 const std::string& host, |
| 92 AddressFamily address_family, | 93 AddressFamily address_family, |
| 93 HostResolverFlags host_resolver_flags, | 94 HostResolverFlags host_resolver_flags, |
| 94 AddressList* out, | 95 AddressList* out, |
| (...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1441 job_pools_[i]->ResetNumOutstandingJobs(); | 1442 job_pools_[i]->ResetNumOutstandingJobs(); |
| 1442 JobMap jobs; | 1443 JobMap jobs; |
| 1443 jobs.swap(jobs_); | 1444 jobs.swap(jobs_); |
| 1444 for (JobMap::iterator it = jobs.begin(); it != jobs.end(); ++it) { | 1445 for (JobMap::iterator it = jobs.begin(); it != jobs.end(); ++it) { |
| 1445 AbortJob(it->second); | 1446 AbortJob(it->second); |
| 1446 it->second->Cancel(); | 1447 it->second->Cancel(); |
| 1447 } | 1448 } |
| 1448 } | 1449 } |
| 1449 | 1450 |
| 1450 } // namespace net | 1451 } // namespace net |
| OLD | NEW |