| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/dns/host_resolver.h" | 5 #include "net/dns/host_resolver.h" | 
| 6 | 6 | 
| 7 #include "base/logging.h" | 7 #include "base/logging.h" | 
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" | 
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" | 
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" | 
| 11 #include "net/dns/dns_client.h" | 11 #include "net/dns/dns_client.h" | 
| 12 #include "net/dns/dns_config_service.h" | 12 #include "net/dns/dns_config_service.h" | 
| 13 #include "net/dns/host_cache.h" | 13 #include "net/dns/host_cache.h" | 
| 14 #include "net/dns/host_resolver_impl.h" | 14 #include "net/dns/host_resolver_impl.h" | 
| 15 | 15 | 
| 16 namespace net { | 16 namespace net { | 
| 17 | 17 | 
| 18 namespace { | 18 namespace { | 
| 19 | 19 | 
| 20 // Maximum of 6 concurrent resolver threads (excluding retries). | 20 // Maximum of 6 concurrent resolver threads (excluding retries). | 
| 21 // Some routers (or resolvers) appear to start to provide host-not-found if | 21 // Some routers (or resolvers) appear to start to provide host-not-found if | 
| 22 // too many simultaneous resolutions are pending.  This number needs to be | 22 // too many simultaneous resolutions are pending.  This number needs to be | 
| 23 // further optimized, but 8 is what FF currently does. We found some routers | 23 // further optimized, but 8 is what FF currently does. We found some routers | 
| 24 // that limit this to 6, so we're temporarily holding it at that level. | 24 // that limit this to 6, so we're temporarily holding it at that level. | 
| 25 const size_t kDefaultMaxProcTasks = 6u; | 25 const size_t kDefaultMaxProcTasks = 6u; | 
| 26 | 26 | 
| 27 // When configuring from field trial, do not allow |  | 
| 28 const size_t kSaneMaxProcTasks = 20u; |  | 
| 29 |  | 
| 30 PrioritizedDispatcher::Limits GetDispatcherLimits( | 27 PrioritizedDispatcher::Limits GetDispatcherLimits( | 
| 31     const HostResolver::Options& options) { | 28     const HostResolver::Options& options) { | 
| 32   PrioritizedDispatcher::Limits limits(NUM_PRIORITIES, | 29   PrioritizedDispatcher::Limits limits(NUM_PRIORITIES, | 
| 33                                        options.max_concurrent_resolves); | 30                                        options.max_concurrent_resolves); | 
| 34 | 31 | 
| 35   // If not using default, do not use the field trial. | 32   // If not using default, do not use the field trial. | 
| 36   if (limits.total_jobs != HostResolver::kDefaultParallelism) | 33   if (limits.total_jobs != HostResolver::kDefaultParallelism) | 
| 37     return limits; | 34     return limits; | 
| 38 | 35 | 
| 39   // Default, without trial is no reserved slots. | 36   // Default, without trial is no reserved slots. | 
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 134 // static | 131 // static | 
| 135 scoped_ptr<HostResolver> | 132 scoped_ptr<HostResolver> | 
| 136 HostResolver::CreateDefaultResolver(NetLog* net_log) { | 133 HostResolver::CreateDefaultResolver(NetLog* net_log) { | 
| 137   return CreateSystemResolver(Options(), net_log); | 134   return CreateSystemResolver(Options(), net_log); | 
| 138 } | 135 } | 
| 139 | 136 | 
| 140 HostResolver::HostResolver() { | 137 HostResolver::HostResolver() { | 
| 141 } | 138 } | 
| 142 | 139 | 
| 143 }  // namespace net | 140 }  // namespace net | 
| OLD | NEW | 
|---|