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

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: 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 // TODO(asvitkine): This logic should run for all child processes.
Alexei Svitkine (slow) 2016/04/28 15:23:33 Thanks! You can add 563705 to the BUG= line of thi
erikchen 2016/04/29 17:45:04 Done.
736 if (process_type == switches::kGpuProcess ||
737 process_type == switches::kUtilityProcess ||
738 process_type == switches::kPpapiPluginProcess) {
739 // Initialize statistical testing infrastructure. We set the entropy
740 // provider to NULL to disallow non-browser processes from creating their
741 // own one-time randomized trials; they should be created in the browser
742 // process.
743 base::FieldTrialList field_trial_list(NULL);
Alexei Svitkine (slow) 2016/04/28 15:23:33 This is not correct. The FieldTrialList should sta
erikchen 2016/04/29 17:45:04 You keep talking about "the loop". Are you referri
Alexei Svitkine (slow) 2016/04/29 18:06:31 Woops, when I said "loop" I meant "if". Sorry for
744
745 // Ensure any field trials in browser are reflected into the child
746 // process.
747 if (command_line.HasSwitch(switches::kForceFieldTrials)) {
Alexei Svitkine (slow) 2016/04/28 15:23:33 It would be good to check whether we propagate thi
erikchen 2016/04/29 17:45:04 We weren't propagating it. I added it to ChildProc
748 bool result = base::FieldTrialList::CreateTrialsFromString(
749 command_line.GetSwitchValueASCII(switches::kForceFieldTrials),
750 std::set<std::string>());
751 DCHECK(result);
752 }
753
754 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
755 feature_list->InitializeFromCommandLine(
756 command_line.GetSwitchValueASCII(switches::kEnableFeatures),
757 command_line.GetSwitchValueASCII(switches::kDisableFeatures));
758 base::FeatureList::SetInstance(std::move(feature_list));
759 }
760
732 base::HistogramBase::EnableActivityReportHistogram(process_type); 761 base::HistogramBase::EnableActivityReportHistogram(process_type);
733 762
734 MainFunctionParams main_params(command_line); 763 MainFunctionParams main_params(command_line);
735 main_params.ui_task = ui_task_; 764 main_params.ui_task = ui_task_;
736 #if defined(OS_WIN) 765 #if defined(OS_WIN)
737 main_params.sandbox_info = &sandbox_info_; 766 main_params.sandbox_info = &sandbox_info_;
738 #elif defined(OS_MACOSX) 767 #elif defined(OS_MACOSX)
739 main_params.autorelease_pool = autorelease_pool_.get(); 768 main_params.autorelease_pool = autorelease_pool_.get();
740 #endif 769 #endif
741 770
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 827
799 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 828 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
800 }; 829 };
801 830
802 // static 831 // static
803 ContentMainRunner* ContentMainRunner::Create() { 832 ContentMainRunner* ContentMainRunner::Create() {
804 return new ContentMainRunnerImpl(); 833 return new ContentMainRunnerImpl();
805 } 834 }
806 835
807 } // namespace content 836 } // 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