diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-08 22:15:54 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-08 22:15:54 +0000 |
commit | 32eaa332c7ef3f5480b0e5cfc4f42418a13c9189 (patch) | |
tree | 2d3155f68162a9523b1b12cbb54c8a35863664a7 /chrome/browser/io_thread.cc | |
parent | 26788a65a7f9094a0acd44ea69c3cdbea5b1f498 (diff) | |
download | chromium_src-32eaa332c7ef3f5480b0e5cfc4f42418a13c9189.zip chromium_src-32eaa332c7ef3f5480b0e5cfc4f42418a13c9189.tar.gz chromium_src-32eaa332c7ef3f5480b0e5cfc4f42418a13c9189.tar.bz2 |
Add IPv6 probing support, and disable IPv6 resolution when it is useless
I've added minimal probing to check if IPv6 is at all possible, and when it is not, then we disable IPv6 resolution.
I've also added histograms and A/B test support to evaluate the impact of
this change.
(I landed originally, but had tree problems, and this is a new CL to tryto reland).
Note that I've switched back to MACRO style enums as well, per http://dev.chromium.org/developers/coding-style
(search for "enum").
This version now does the conditional testing at a higher level (in io_thread.h), so that it should interfere less with other testing.
r=wtc,eroman
Review URL: http://codereview.chromium.org/585005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38402 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/io_thread.cc')
-rw-r--r-- | chrome/browser/io_thread.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 39f4cf6..33604f5 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -15,6 +15,7 @@ #include "net/base/host_cache.h" #include "net/base/host_resolver.h" #include "net/base/host_resolver_impl.h" +#include "net/base/net_util.h" #include "net/base/network_change_notifier.h" #include "net/url_request/url_request.h" @@ -36,8 +37,24 @@ net::HostResolver* CreateGlobalHostResolver( global_host_resolver = net::CreateSystemHostResolver(network_change_notifier); - if (command_line.HasSwitch(switches::kDisableIPv6)) - global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); + 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)) + global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); + } } return global_host_resolver; |