diff options
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r-- | chrome/browser/browser_main.cc | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 91bc5e4..5a52734 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -690,15 +690,34 @@ int BrowserMain(const MainFunctionParams& parameters) { PluginService::GetInstance()->SetChromePluginDataDir(profile->GetPath()); // Prepare for memory caching of SDCH dictionaries. - SdchManager sdch_manager; // Construct singleton database. - sdch_manager.set_sdch_fetcher(new SdchDictionaryFetcher); - // Use default of "" so that all domains are supported. + // Perform A/B test to measure global impact of SDCH support. + // Set up a field trial to see what disabling SDCH does to latency of page + // layout globally. + FieldTrial::Probability kSDCH_DIVISOR = 100; + FieldTrial::Probability kSDCH_PROBABILITY_PER_GROUP = 50; // 50% probability. + scoped_refptr<FieldTrial> sdch_trial = + new FieldTrial("GlobalSdch", kSDCH_DIVISOR); + + bool need_to_init_sdch = true; std::string switch_domain(""); if (parsed_command_line.HasSwitch(switches::kSdchFilter)) { switch_domain = WideToASCII(parsed_command_line.GetSwitchValue(switches::kSdchFilter)); + } else { + sdch_trial->AppendGroup("_global_disable_sdch", + kSDCH_PROBABILITY_PER_GROUP); + int sdch_enabled = sdch_trial->AppendGroup("_global_enable_sdch", + kSDCH_PROBABILITY_PER_GROUP); + need_to_init_sdch = (sdch_enabled == sdch_trial->group()); + } + + scoped_ptr<SdchManager> sdch_manager; // Singleton database. + if (need_to_init_sdch) { + sdch_manager.reset(new SdchManager); + sdch_manager->set_sdch_fetcher(new SdchDictionaryFetcher); + // Use default of "" so that all domains are supported. + sdch_manager->EnableSdchSupport(switch_domain); } - sdch_manager.EnableSdchSupport(switch_domain); MetricsService* metrics = NULL; if (!parsed_command_line.HasSwitch(switches::kDisableMetrics)) { |