summaryrefslogtreecommitdiffstats
path: root/chrome/browser/io_thread.cc
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-26 05:33:45 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-26 05:33:45 +0000
commit7be4c7eef651408e7e0cd30edf5b48e2ee93f226 (patch)
treeb3d6849e0df9a999c5a9d6425dd4004bd474d508 /chrome/browser/io_thread.cc
parent196e32aed9931577e45f76d482f5db8372a51a31 (diff)
downloadchromium_src-7be4c7eef651408e7e0cd30edf5b48e2ee93f226.zip
chromium_src-7be4c7eef651408e7e0cd30edf5b48e2ee93f226.tar.gz
chromium_src-7be4c7eef651408e7e0cd30edf5b48e2ee93f226.tar.bz2
Revert 39998 - Revert 39996 Refine IPv6 probe to require that the client has an IPv6 address on an interface
This is a second attempt to land a reviewed change. It was reverted because the tree got very red (for other reasons), and it was plausible that this change was causing startup latency in Mac and Linux (causing both perf bots to go red). If this landing turns those perf-bots red (tonight) I'll need to revert. (... and I'll need to rearchitect to do the probes asynchronously, and get off the startup-critical-path. This currently only works on Posix, not windows. Network changes are monitored, and the test is repeated each time interfaces change (which is a subset of any IP addresses changing). The test performed is still relatively low latency, and we *may* need to eventually move to an high latency test, such as a DNS resolution, or an actual test connection. If we move in that direction, then we'll need to post a task to perform the work, rather than immediately returning. BUG=25680 BUG=12754 r=wtc,eroman Review URL: http://codereview.chromium.org/652072 TBR=jar@chromium.org Review URL: http://codereview.chromium.org/660073 TBR=jar@chromium.org Review URL: http://codereview.chromium.org/661164 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/io_thread.cc')
-rw-r--r--chrome/browser/io_thread.cc61
1 files changed, 33 insertions, 28 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index f4d4698..6378c50 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -24,44 +24,49 @@ namespace {
net::HostResolver* CreateGlobalHostResolver(
net::NetworkChangeNotifier* network_change_notifier) {
- net::HostResolver* global_host_resolver = NULL;
-
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
-
- global_host_resolver =
+ net::HostResolver* global_host_resolver =
net::CreateSystemHostResolver(network_change_notifier);
+ // Determine if we should disable IPv6 support.
if (!command_line.HasSwitch(switches::kEnableIPv6)) {
- // Measure impact of allowing IPv6 support without probing.
- const FieldTrial::Probability kDivisor = 100;
- const FieldTrial::Probability kProbability = 50; // 50% probability.
- FieldTrial* trial = new FieldTrial("IPv6_Probe", kDivisor);
- int skip_group = trial->AppendGroup("_IPv6_probe_skipped", kProbability);
- trial->AppendGroup("_IPv6_probe_done",
- FieldTrial::kAllRemainingProbability);
- bool use_ipv6_probe = (trial->group() != skip_group);
-
- // Perform probe, and then optionally use result to disable IPv6.
- // Some users report confused OS handling of IPv6, leading to large
- // latency. If we can show that IPv6 is not supported, then disabliing it
- // will work around such problems.
- if ((!net::IPv6Supported() && use_ipv6_probe) ||
- command_line.HasSwitch(switches::kDisableIPv6))
+ if (command_line.HasSwitch(switches::kDisableIPv6)) {
global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4);
+ } else {
+ net::HostResolverImpl* host_resolver_impl =
+ global_host_resolver->GetAsHostResolverImpl();
+ if (host_resolver_impl != NULL) {
+ // (optionally) Use probe to decide if support is warranted.
+
+ // Measure impact of probing to allow IPv6.
+ // Some users report confused OS handling of IPv6, leading to large
+ // latency. If we can show that IPv6 is not supported, then disabliing
+ // it will work around such problems.
+ const FieldTrial::Probability kDivisor = 100;
+ const FieldTrial::Probability kProbability = 50; // 50% probability.
+ FieldTrial* trial = new FieldTrial("IPv6_Probe", kDivisor);
+ int skip_group = trial->AppendGroup("_IPv6_probe_skipped",
+ kProbability);
+ trial->AppendGroup("_IPv6_probe_done",
+ FieldTrial::kAllRemainingProbability);
+ bool use_ipv6_probe = (trial->group() != skip_group);
+ if (use_ipv6_probe)
+ host_resolver_impl->ProbeIPv6Support();
+ }
+ }
}
// If hostname remappings were specified on the command-line, layer these
// rules on top of the real host resolver. This allows forwarding all requests
// through a designated test server.
- if (command_line.HasSwitch(switches::kHostResolverRules)) {
- net::MappedHostResolver* remapped_resolver =
- new net::MappedHostResolver(global_host_resolver);
- global_host_resolver = remapped_resolver;
- remapped_resolver->SetRulesFromString(
- command_line.GetSwitchValueASCII(switches::kHostResolverRules));
- }
-
- return global_host_resolver;
+ if (!command_line.HasSwitch(switches::kHostResolverRules))
+ return global_host_resolver;
+
+ net::MappedHostResolver* remapped_resolver =
+ new net::MappedHostResolver(global_host_resolver);
+ remapped_resolver->SetRulesFromString(
+ command_line.GetSwitchValueASCII(switches::kHostResolverRules));
+ return remapped_resolver;
}
} // namespace