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

Side by Side Diff: chrome/browser/chrome_browser_field_trials.cc

Issue 2307953002: Adding client side field trial for sampling on non-stable channels. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_services_manager_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_field_trials.h" 5 #include "chrome/browser/chrome_browser_field_trials.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/histogram_base.h" 13 #include "base/metrics/histogram_base.h"
14 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
15 #include "base/metrics/persistent_histogram_allocator.h" 15 #include "base/metrics/persistent_histogram_allocator.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "chrome/browser/metrics/chrome_metrics_service_client.h" 20 #include "chrome/browser/metrics/chrome_metrics_service_client.h"
21 #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" 21 #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h"
22 #include "chrome/browser/tracing/background_tracing_field_trial.h" 22 #include "chrome/browser/tracing/background_tracing_field_trial.h"
23 #include "chrome/common/channel_info.h" 23 #include "chrome/common/channel_info.h"
24 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "components/metrics/metrics_pref_names.h" 26 #include "components/metrics/metrics_pref_names.h"
27 #include "components/variations/variations_associated_data.h" 27 #include "components/variations/variations_associated_data.h"
28 #include "components/version_info/version_info.h"
29 28
30 #if defined(OS_ANDROID) 29 #if defined(OS_ANDROID)
31 #include "chrome/browser/chrome_browser_field_trials_mobile.h" 30 #include "chrome/browser/chrome_browser_field_trials_mobile.h"
32 #else 31 #else
33 #include "chrome/browser/chrome_browser_field_trials_desktop.h" 32 #include "chrome/browser/chrome_browser_field_trials_desktop.h"
34 #endif 33 #endif
35 34
36 namespace { 35 namespace {
37 36
38 // Check for feature enabling the use of persistent histogram storage and 37 // Check for feature enabling the use of persistent histogram storage and
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 base::FeatureList* feature_list) { 119 base::FeatureList* feature_list) {
121 #if defined(OS_WIN) || defined(OS_ANDROID) 120 #if defined(OS_WIN) || defined(OS_ANDROID)
122 // Only create the fallback trial if there isn't already a variations seed 121 // Only create the fallback trial if there isn't already a variations seed
123 // being applied. This should occur during first run when first-run variations 122 // being applied. This should occur during first run when first-run variations
124 // isn't supported. It's assumed that, if there is a seed, then it either 123 // isn't supported. It's assumed that, if there is a seed, then it either
125 // contains the relavent study, or is intentionally omitted, so no fallback is 124 // contains the relavent study, or is intentionally omitted, so no fallback is
126 // needed. 125 // needed.
127 if (has_seed) 126 if (has_seed)
128 return; 127 return;
129 128
130 // Sampling is only supported on Stable. 129 ChromeMetricsServicesManagerClient::CreateFallbackSamplingTrial(
131 if (chrome::GetChannel() != version_info::Channel::STABLE) 130 chrome::GetChannel(), feature_list);
132 return;
133
134 ChromeMetricsServicesManagerClient::CreateFallbackSamplingTrial(feature_list);
135 #endif // defined(OS_WIN) || defined(OS_ANDROID) 131 #endif // defined(OS_WIN) || defined(OS_ANDROID)
136 } 132 }
137 133
138 } // namespace 134 } // namespace
139 135
140 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( 136 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials(
141 const base::CommandLine& parsed_command_line) 137 const base::CommandLine& parsed_command_line)
142 : parsed_command_line_(parsed_command_line) { 138 : parsed_command_line_(parsed_command_line) {
143 } 139 }
144 140
(...skipping 15 matching lines...) Expand all
160 bool has_seed, 156 bool has_seed,
161 base::FeatureList* feature_list) { 157 base::FeatureList* feature_list) {
162 CreateFallbackSamplingTrialIfNeeded(has_seed, feature_list); 158 CreateFallbackSamplingTrialIfNeeded(has_seed, feature_list);
163 } 159 }
164 160
165 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { 161 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() {
166 // Persistent histograms must be enabled as soon as possible. 162 // Persistent histograms must be enabled as soon as possible.
167 InstantiatePersistentHistograms(); 163 InstantiatePersistentHistograms();
168 tracing::SetupBackgroundTracingFieldTrial(); 164 tracing::SetupBackgroundTracingFieldTrial();
169 } 165 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_services_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698