diff options
author | gavinp@google.com <gavinp@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 18:58:51 +0000 |
---|---|---|
committer | gavinp@google.com <gavinp@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 18:58:51 +0000 |
commit | 8a3125a7100ffc53f6731604fcf299ab9331e0ba (patch) | |
tree | 2b501b77f420de8cd6a2d08133fb4ebb83e4330f /chrome/browser/browser_main.cc | |
parent | d66a7dda015fa05244582c31cc7b3be2f00a559f (diff) | |
download | chromium_src-8a3125a7100ffc53f6731604fcf299ab9331e0ba.zip chromium_src-8a3125a7100ffc53f6731604fcf299ab9331e0ba.tar.gz chromium_src-8a3125a7100ffc53f6731604fcf299ab9331e0ba.tar.bz2 |
Histograms & Field Trails about prefetching
This CL lands some histograms to track prefetching, and a 10% field trial
enabling the feature to track performance.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3036050
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55431 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r-- | chrome/browser/browser_main.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index cf806fc..5f8fa20 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -171,6 +171,7 @@ void BrowserMainParts::EarlyInitialization() { SocketTimeoutFieldTrial(); ProxyConnectionsFieldTrial(); SpdyFieldTrial(); + PrefetchFieldTrial(); InitializeSSL(); PostEarlyInitialization(); @@ -364,6 +365,28 @@ void BrowserMainParts::SpdyFieldTrial() { } } +// If neither --enable-content-prefetch or --disable-content-prefetch +// is set, users will be in an A/B test for prefetching. +void BrowserMainParts::PrefetchFieldTrial() { + if (parsed_command_line().HasSwitch(switches::kEnableContentPrefetch)) + ResourceDispatcherHost::set_is_prefetch_enabled(true); + else if (parsed_command_line().HasSwitch(switches::kDisableContentPrefetch)) { + ResourceDispatcherHost::set_is_prefetch_enabled(false); + } else { + const FieldTrial::Probability kPrefetchDivisor = 100; + const FieldTrial::Probability no_prefetch_probability = 90; + scoped_refptr<FieldTrial> trial = + new FieldTrial("Prefetch", kPrefetchDivisor); + trial->AppendGroup("ContentPrefetchDisabled", no_prefetch_probability); + const int yes_prefetch_grp = + trial->AppendGroup("ContentPrefetchEnabled", + FieldTrial::kAllRemainingProbability); + const int trial_grp = trial->group(); + ResourceDispatcherHost::set_is_prefetch_enabled( + trial_grp == yes_prefetch_grp); + } +} + // BrowserMainParts: |MainMessageLoopStart()| and related ---------------------- void BrowserMainParts::MainMessageLoopStart() { |