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 "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/leak_tracker.h" | 7 #include "base/leak_tracker.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // Determine if we should disable IPv6 support. | 34 // Determine if we should disable IPv6 support. |
35 if (!command_line.HasSwitch(switches::kEnableIPv6)) { | 35 if (!command_line.HasSwitch(switches::kEnableIPv6)) { |
36 if (command_line.HasSwitch(switches::kDisableIPv6)) { | 36 if (command_line.HasSwitch(switches::kDisableIPv6)) { |
37 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 37 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
38 } else { | 38 } else { |
39 net::HostResolverImpl* host_resolver_impl = | 39 net::HostResolverImpl* host_resolver_impl = |
40 global_host_resolver->GetAsHostResolverImpl(); | 40 global_host_resolver->GetAsHostResolverImpl(); |
41 if (host_resolver_impl != NULL) { | 41 if (host_resolver_impl != NULL) { |
42 // (optionally) Use probe to decide if support is warranted. | 42 // (optionally) Use probe to decide if support is warranted. |
| 43 bool use_ipv6_probe = true; |
43 | 44 |
| 45 #if defined(OS_WIN) |
44 // Measure impact of probing to allow IPv6. | 46 // Measure impact of probing to allow IPv6. |
45 // Some users report confused OS handling of IPv6, leading to large | 47 // Some users report confused OS handling of IPv6, leading to large |
46 // latency. If we can show that IPv6 is not supported, then disabliing | 48 // latency. If we can show that IPv6 is not supported, then disabliing |
47 // it will work around such problems. | 49 // it will work around such problems. This is the test of the probe. |
48 const FieldTrial::Probability kDivisor = 100; | 50 const FieldTrial::Probability kDivisor = 100; |
49 const FieldTrial::Probability kProbability = 50; // 50% probability. | 51 const FieldTrial::Probability kProbability = 50; // 50% probability. |
50 FieldTrial* trial = new FieldTrial("IPv6_Probe", kDivisor); | 52 FieldTrial* trial = new FieldTrial("IPv6_Probe", kDivisor); |
51 int skip_group = trial->AppendGroup("_IPv6_probe_skipped", | 53 int skip_group = trial->AppendGroup("_IPv6_probe_skipped", |
52 kProbability); | 54 kProbability); |
53 trial->AppendGroup("_IPv6_probe_done", | 55 trial->AppendGroup("_IPv6_probe_done", |
54 FieldTrial::kAllRemainingProbability); | 56 FieldTrial::kAllRemainingProbability); |
55 bool use_ipv6_probe = (trial->group() != skip_group); | 57 use_ipv6_probe = (trial->group() != skip_group); |
| 58 #endif |
| 59 |
56 if (use_ipv6_probe) | 60 if (use_ipv6_probe) |
57 host_resolver_impl->ProbeIPv6Support(); | 61 host_resolver_impl->ProbeIPv6Support(); |
58 } | 62 } |
59 } | 63 } |
60 } | 64 } |
61 | 65 |
62 // If hostname remappings were specified on the command-line, layer these | 66 // If hostname remappings were specified on the command-line, layer these |
63 // rules on top of the real host resolver. This allows forwarding all requests | 67 // rules on top of the real host resolver. This allows forwarding all requests |
64 // through a designated test server. | 68 // through a designated test server. |
65 if (!command_line.HasSwitch(switches::kHostResolverRules)) | 69 if (!command_line.HasSwitch(switches::kHostResolverRules)) |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 net::HostCache* host_cache = | 251 net::HostCache* host_cache = |
248 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 252 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
249 if (host_cache) | 253 if (host_cache) |
250 host_cache->clear(); | 254 host_cache->clear(); |
251 } | 255 } |
252 // Clear all of the passively logged data. | 256 // Clear all of the passively logged data. |
253 // TODO(eroman): this is a bit heavy handed, really all we need to do is | 257 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
254 // clear the data pertaining to off the record context. | 258 // clear the data pertaining to off the record context. |
255 globals_->net_log->passive_collector()->Clear(); | 259 globals_->net_log->passive_collector()->Clear(); |
256 } | 260 } |
OLD | NEW |