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

Side by Side Diff: content/app/content_main_runner.cc

Issue 2365273004: Initial implementation for sharing field trial state (win) (Closed)
Patch Set: Address comments Created 4 years, 2 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
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 "content/public/app/content_main_runner.h" 5 #include "content/public/app/content_main_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 14 matching lines...) Expand all
25 #include "base/lazy_instance.h" 25 #include "base/lazy_instance.h"
26 #include "base/logging.h" 26 #include "base/logging.h"
27 #include "base/macros.h" 27 #include "base/macros.h"
28 #include "base/memory/scoped_vector.h" 28 #include "base/memory/scoped_vector.h"
29 #include "base/metrics/field_trial.h" 29 #include "base/metrics/field_trial.h"
30 #include "base/metrics/histogram_base.h" 30 #include "base/metrics/histogram_base.h"
31 #include "base/metrics/statistics_recorder.h" 31 #include "base/metrics/statistics_recorder.h"
32 #include "base/path_service.h" 32 #include "base/path_service.h"
33 #include "base/process/launch.h" 33 #include "base/process/launch.h"
34 #include "base/process/memory.h" 34 #include "base/process/memory.h"
35 #include "base/process/process.h"
35 #include "base/process/process_handle.h" 36 #include "base/process/process_handle.h"
36 #include "base/profiler/scoped_tracker.h" 37 #include "base/profiler/scoped_tracker.h"
37 #include "base/strings/string_number_conversions.h" 38 #include "base/strings/string_number_conversions.h"
38 #include "base/strings/string_util.h" 39 #include "base/strings/string_util.h"
39 #include "base/strings/stringprintf.h" 40 #include "base/strings/stringprintf.h"
40 #include "base/trace_event/trace_event.h" 41 #include "base/trace_event/trace_event.h"
41 #include "build/build_config.h" 42 #include "build/build_config.h"
42 #include "components/tracing/browser/trace_config_file.h" 43 #include "components/tracing/browser/trace_config_file.h"
43 #include "components/tracing/common/trace_to_console.h" 44 #include "components/tracing/common/trace_to_console.h"
44 #include "components/tracing/common/tracing_switches.h" 45 #include "components/tracing/common/tracing_switches.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 *base::CommandLine::ForCurrentProcess(); 140 *base::CommandLine::ForCurrentProcess();
140 141
141 // Initialize statistical testing infrastructure. We set the entropy 142 // Initialize statistical testing infrastructure. We set the entropy
142 // provider to nullptr to disallow non-browser processes from creating 143 // provider to nullptr to disallow non-browser processes from creating
143 // their own one-time randomized trials; they should be created in the 144 // their own one-time randomized trials; they should be created in the
144 // browser process. 145 // browser process.
145 field_trial_list->reset(new base::FieldTrialList(nullptr)); 146 field_trial_list->reset(new base::FieldTrialList(nullptr));
146 147
147 // Ensure any field trials in browser are reflected into the child 148 // Ensure any field trials in browser are reflected into the child
148 // process. 149 // process.
149 if (command_line.HasSwitch(switches::kForceFieldTrials)) { 150 base::FieldTrialList::CreateTrialsFromCommandLine(
150 bool result = base::FieldTrialList::CreateTrialsFromString( 151 command_line, switches::kFieldTrialHandle);
151 command_line.GetSwitchValueASCII(switches::kForceFieldTrials),
152 std::set<std::string>());
153 DCHECK(result);
154 }
155 152
156 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); 153 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
157 feature_list->InitializeFromCommandLine( 154 feature_list->InitializeFromCommandLine(
158 command_line.GetSwitchValueASCII(switches::kEnableFeatures), 155 command_line.GetSwitchValueASCII(switches::kEnableFeatures),
159 command_line.GetSwitchValueASCII(switches::kDisableFeatures)); 156 command_line.GetSwitchValueASCII(switches::kDisableFeatures));
160 base::FeatureList::SetInstance(std::move(feature_list)); 157 base::FeatureList::SetInstance(std::move(feature_list));
161 } 158 }
162 159
163 } // namespace 160 } // namespace
164 161
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 839
843 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 840 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
844 }; 841 };
845 842
846 // static 843 // static
847 ContentMainRunner* ContentMainRunner::Create() { 844 ContentMainRunner* ContentMainRunner::Create() {
848 return new ContentMainRunnerImpl(); 845 return new ContentMainRunnerImpl();
849 } 846 }
850 847
851 } // namespace content 848 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698