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

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

Issue 1928863002: Enable FeatureList for the GPU process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from asvitkine. Created 4 years, 7 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 | content/browser/gpu/gpu_process_host.cc » ('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 "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
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/allocator/allocator_check.h" 15 #include "base/allocator/allocator_check.h"
16 #include "base/allocator/allocator_extension.h" 16 #include "base/allocator/allocator_extension.h"
17 #include "base/at_exit.h" 17 #include "base/at_exit.h"
18 #include "base/base_switches.h"
18 #include "base/command_line.h" 19 #include "base/command_line.h"
19 #include "base/debug/debugger.h" 20 #include "base/debug/debugger.h"
20 #include "base/debug/stack_trace.h" 21 #include "base/debug/stack_trace.h"
22 #include "base/feature_list.h"
21 #include "base/files/file_path.h" 23 #include "base/files/file_path.h"
22 #include "base/i18n/icu_util.h" 24 #include "base/i18n/icu_util.h"
23 #include "base/lazy_instance.h" 25 #include "base/lazy_instance.h"
24 #include "base/logging.h" 26 #include "base/logging.h"
25 #include "base/macros.h" 27 #include "base/macros.h"
26 #include "base/memory/scoped_vector.h" 28 #include "base/memory/scoped_vector.h"
29 #include "base/metrics/field_trial.h"
27 #include "base/metrics/histogram_base.h" 30 #include "base/metrics/histogram_base.h"
28 #include "base/metrics/statistics_recorder.h" 31 #include "base/metrics/statistics_recorder.h"
29 #include "base/path_service.h" 32 #include "base/path_service.h"
30 #include "base/process/launch.h" 33 #include "base/process/launch.h"
31 #include "base/process/memory.h" 34 #include "base/process/memory.h"
32 #include "base/process/process_handle.h" 35 #include "base/process/process_handle.h"
33 #include "base/profiler/scoped_tracker.h" 36 #include "base/profiler/scoped_tracker.h"
34 #include "base/strings/string_number_conversions.h" 37 #include "base/strings/string_number_conversions.h"
35 #include "base/strings/string_util.h" 38 #include "base/strings/string_util.h"
36 #include "base/strings/stringprintf.h" 39 #include "base/strings/stringprintf.h"
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } 725 }
723 726
724 int Run() override { 727 int Run() override {
725 DCHECK(is_initialized_); 728 DCHECK(is_initialized_);
726 DCHECK(!is_shutdown_); 729 DCHECK(!is_shutdown_);
727 const base::CommandLine& command_line = 730 const base::CommandLine& command_line =
728 *base::CommandLine::ForCurrentProcess(); 731 *base::CommandLine::ForCurrentProcess();
729 std::string process_type = 732 std::string process_type =
730 command_line.GetSwitchValueASCII(switches::kProcessType); 733 command_line.GetSwitchValueASCII(switches::kProcessType);
731 734
735 // Initialize statistical testing infrastructure. We set the entropy
736 // provider to NULL to disallow non-browser processes from creating their
Alexei Svitkine (slow) 2016/04/29 18:06:32 Nit: NULL -> null and NULL -> nullptr below.
erikchen 2016/04/29 18:34:38 Done.
737 // own one-time randomized trials; they should be created in the browser
738 // process.
739 base::FieldTrialList field_trial_list(NULL);
Alexei Svitkine (slow) 2016/04/29 18:06:32 How does this interact with: https://code.google.
erikchen 2016/04/29 18:34:38 whoops! I had meant to remove that.
740
741 // TODO(asvitkine): This logic should run for all child processes.
742 // https://crbug.com/563705.
743 if (process_type == switches::kGpuProcess ||
744 process_type == switches::kUtilityProcess ||
745 process_type == switches::kPpapiPluginProcess) {
746 // Ensure any field trials in browser are reflected into the child
747 // process.
748 if (command_line.HasSwitch(switches::kForceFieldTrials)) {
749 bool result = base::FieldTrialList::CreateTrialsFromString(
750 command_line.GetSwitchValueASCII(switches::kForceFieldTrials),
751 std::set<std::string>());
752 DCHECK(result);
753 }
754
755 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
756 feature_list->InitializeFromCommandLine(
757 command_line.GetSwitchValueASCII(switches::kEnableFeatures),
758 command_line.GetSwitchValueASCII(switches::kDisableFeatures));
759 base::FeatureList::SetInstance(std::move(feature_list));
760 }
761
732 base::HistogramBase::EnableActivityReportHistogram(process_type); 762 base::HistogramBase::EnableActivityReportHistogram(process_type);
733 763
734 MainFunctionParams main_params(command_line); 764 MainFunctionParams main_params(command_line);
735 main_params.ui_task = ui_task_; 765 main_params.ui_task = ui_task_;
736 #if defined(OS_WIN) 766 #if defined(OS_WIN)
737 main_params.sandbox_info = &sandbox_info_; 767 main_params.sandbox_info = &sandbox_info_;
738 #elif defined(OS_MACOSX) 768 #elif defined(OS_MACOSX)
739 main_params.autorelease_pool = autorelease_pool_.get(); 769 main_params.autorelease_pool = autorelease_pool_.get();
740 #endif 770 #endif
741 771
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 828
799 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 829 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
800 }; 830 };
801 831
802 // static 832 // static
803 ContentMainRunner* ContentMainRunner::Create() { 833 ContentMainRunner* ContentMainRunner::Create() {
804 return new ContentMainRunnerImpl(); 834 return new ContentMainRunnerImpl();
805 } 835 }
806 836
807 } // namespace content 837 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698