Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6866)

Unified Diff: chrome/renderer/page_load_histograms.cc

Issue 6883102: Add one-time randomization support for FieldTrial, and the ability to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responding to review comments. Fix initialization in browser_main. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/page_load_histograms.cc
diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc
index 32a75e2020f9022cfceb0bb02e75fdef55b679cc..c4da8a351c8a3dd466681052131bb7500b2ce080 100644
--- a/chrome/renderer/page_load_histograms.cc
+++ b/chrome/renderer/page_load_histograms.cc
@@ -40,9 +40,8 @@ void UpdatePrerenderHistograms(NavigationState* navigation_state,
const Time& finish_all_loads,
const TimeDelta& begin_to_finish_all_loads) {
// Load time for non-prerendered pages.
- static bool use_prerender_histogram =
- base::FieldTrialList::Find("Prefetch") &&
- !base::FieldTrialList::Find("Prefetch")->group_name().empty();
+ static const bool use_prerender_histogram =
+ base::FieldTrialList::TrialExists("Prefetch");
if (!navigation_state->was_started_as_prerender()) {
if (use_prerender_histogram) {
PLT_HISTOGRAM(base::FieldTrial::MakeName(
@@ -331,8 +330,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) {
begin_to_finish_all_loads);
// 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"),
@@ -368,8 +367,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(
@@ -399,9 +397,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"),
@@ -439,9 +436,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"),
@@ -473,9 +469,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"),
@@ -507,10 +502,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"),
@@ -543,8 +536,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"),
@@ -581,8 +574,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
@@ -592,9 +585,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"),
@@ -652,8 +644,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(
@@ -810,8 +802,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) {

Powered by Google App Engine
This is Rietveld 408576698