diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-10 17:18:53 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-10 17:18:53 +0000 |
commit | edafd4c1a5c906e808e2448810e2099d8dc704b9 (patch) | |
tree | 4ccc930c0b9ff8663183ebb6333e9ac990f0e491 /chrome/renderer/page_load_histograms.cc | |
parent | 063bb25a11a9258c44d61210dfd98f41e7b4f24a (diff) | |
download | chromium_src-edafd4c1a5c906e808e2448810e2099d8dc704b9.zip chromium_src-edafd4c1a5c906e808e2448810e2099d8dc704b9.tar.gz chromium_src-edafd4c1a5c906e808e2448810e2099d8dc704b9.tar.bz2 |
Add one-time randomization support for FieldTrial, and the ability to
disable field trials. I am going to have a need for both soon.
Update some documentation about empty trial names, add TrialExists() method and update many call-sites to use this (it simplifies the previous logic which checked for existence and then for non-empty name, which can no longer happen).
Refactor a bit in browser_main.
While I'm in there and needing base/OWNERS approval, add an OWNERS
file for base/metrics that adds jar@chromium.org as an owner for that
directory.
Initially committed as r84197.
Rolled back due to DCHECK in official builds, r84373.
Will re-submit with fix.
BUG=81750
TEST=base_unittests
Review URL: http://codereview.chromium.org/6883102
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/page_load_histograms.cc')
-rw-r--r-- | chrome/renderer/page_load_histograms.cc | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc index 3ae1498..6bd2c85 100644 --- a/chrome/renderer/page_load_histograms.cc +++ b/chrome/renderer/page_load_histograms.cc @@ -270,8 +270,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { } // Histograms to determine if DNS prefetching has an impact on PLT. - static bool use_dns_histogram(base::FieldTrialList::Find("DnsImpact") && - !base::FieldTrialList::Find("DnsImpact")->group_name().empty()); + static const bool use_dns_histogram = + base::FieldTrialList::TrialExists("DnsImpact"); if (use_dns_histogram) { UMA_HISTOGRAM_ENUMERATION( base::FieldTrial::MakeName("PLT.Abandoned", "DnsImpact"), @@ -307,8 +307,7 @@ void PageLoadHistograms::Dump(WebFrame* frame) { // Histograms to determine if content prefetching has an impact on PLT. static const bool prefetching_fieldtrial = - base::FieldTrialList::Find("Prefetch") && - !base::FieldTrialList::Find("Prefetch")->group_name().empty(); + base::FieldTrialList::TrialExists("Prefetch"); if (prefetching_fieldtrial) { if (navigation_state->was_prefetcher()) { PLT_HISTOGRAM(base::FieldTrial::MakeName( @@ -338,9 +337,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { } // Histograms to determine if backup connection jobs have an impact on PLT. - static const bool connect_backup_jobs_fieldtrial( - base::FieldTrialList::Find("ConnnectBackupJobs") && - !base::FieldTrialList::Find("ConnnectBackupJobs")->group_name().empty()); + static const bool connect_backup_jobs_fieldtrial = + base::FieldTrialList::TrialExists("ConnnectBackupJobs"); if (connect_backup_jobs_fieldtrial) { UMA_HISTOGRAM_ENUMERATION( base::FieldTrial::MakeName("PLT.Abandoned", "ConnnectBackupJobs"), @@ -378,9 +376,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { // impact on PLT. // TODO(jar): Consider removing the per-link-type versions. We // really only need LINK_LOAD_NORMAL and NORMAL_LOAD. - static bool use_connection_impact_histogram( - base::FieldTrialList::Find("ConnCountImpact") && - !base::FieldTrialList::Find("ConnCountImpact")->group_name().empty()); + static const bool use_connection_impact_histogram = + base::FieldTrialList::TrialExists("ConnCountImpact"); if (use_connection_impact_histogram) { UMA_HISTOGRAM_ENUMERATION( base::FieldTrial::MakeName("PLT.Abandoned", "ConnCountImpact"), @@ -412,9 +409,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { } // Histograms to determine effect of idle socket timeout. - static bool use_idle_socket_timeout_histogram( - base::FieldTrialList::Find("IdleSktToImpact") && - !base::FieldTrialList::Find("IdleSktToImpact")->group_name().empty()); + static const bool use_idle_socket_timeout_histogram = + base::FieldTrialList::TrialExists("IdleSktToImpact"); if (use_idle_socket_timeout_histogram) { UMA_HISTOGRAM_ENUMERATION( base::FieldTrial::MakeName("PLT.Abandoned", "IdleSktToImpact"), @@ -446,10 +442,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { } // Histograms to determine effect of number of connections per proxy. - static bool use_proxy_connection_impact_histogram( - base::FieldTrialList::Find("ProxyConnectionImpact") && - !base::FieldTrialList::Find( - "ProxyConnectionImpact")->group_name().empty()); + static const bool use_proxy_connection_impact_histogram = + base::FieldTrialList::TrialExists("ProxyConnectionImpact"); if (use_proxy_connection_impact_histogram) { UMA_HISTOGRAM_ENUMERATION( base::FieldTrial::MakeName("PLT.Abandoned", "ProxyConnectionImpact"), @@ -482,8 +476,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { // Histograms to determine if SDCH has an impact. // TODO(jar): Consider removing per-link load types and the enumeration. - static bool use_sdch_histogram(base::FieldTrialList::Find("GlobalSdch") && - !base::FieldTrialList::Find("GlobalSdch")->group_name().empty()); + static const bool use_sdch_histogram = + base::FieldTrialList::TrialExists("GlobalSdch"); if (use_sdch_histogram) { UMA_HISTOGRAM_ENUMERATION( base::FieldTrial::MakeName("PLT.LoadType", "GlobalSdch"), @@ -520,8 +514,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { } // Histograms to determine if cache size has an impact on PLT. - static bool use_cache_histogram1(base::FieldTrialList::Find("CacheSize") && - !base::FieldTrialList::Find("CacheSize")->group_name().empty()); + static const bool use_cache_histogram1 = + base::FieldTrialList::TrialExists("CacheSize"); if (use_cache_histogram1 && NavigationState::LINK_LOAD_NORMAL <= load_type && NavigationState::LINK_LOAD_CACHE_ONLY >= load_type) { // TODO(mbelshe): Do we really want BeginToFinishDoc here? It seems like @@ -531,9 +525,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { } // Histograms to determine if cache throttling has an impact on PLT. - static bool use_cache_histogram2( - base::FieldTrialList::Find("CacheThrottle") && - !base::FieldTrialList::Find("CacheThrottle")->group_name().empty()); + static const bool use_cache_histogram2 = + base::FieldTrialList::TrialExists("CacheThrottle"); if (use_cache_histogram2) { UMA_HISTOGRAM_ENUMERATION( base::FieldTrial::MakeName("PLT.Abandoned", "CacheThrottle"), @@ -591,8 +584,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { // if we asked for a HTTP request, we got a HTTP request // Due to spdy version mismatches, it is possible that we ask for SPDY // but didn't get SPDY. - static bool use_spdy_histogram(base::FieldTrialList::Find("SpdyImpact") && - !base::FieldTrialList::Find("SpdyImpact")->group_name().empty()); + static const bool use_spdy_histogram = + base::FieldTrialList::TrialExists("SpdyImpact"); if (use_spdy_histogram) { // We take extra effort to only compute these once. static bool in_spdy_trial = base::FieldTrialList::Find( @@ -749,8 +742,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { } } - static bool false_start_trial(base::FieldTrialList::Find("SSLFalseStart") && - !base::FieldTrialList::Find("SSLFalseStart")->group_name().empty()); + static const bool false_start_trial = + base::FieldTrialList::TrialExists("SSLFalseStart"); if (false_start_trial) { if (scheme_type == URLPattern::SCHEME_HTTPS) { switch (load_type) { |