Chromium Code Reviews| Index: content/app/content_main_runner.cc |
| diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc |
| index 01bb5f00f42ce6a9499708f7a53c5766054c62fc..18939da1c8f2c193525d30982a7332ed92acd15c 100644 |
| --- a/content/app/content_main_runner.cc |
| +++ b/content/app/content_main_runner.cc |
| @@ -26,12 +26,14 @@ |
| #include "base/logging.h" |
| #include "base/macros.h" |
| #include "base/memory/scoped_vector.h" |
| +#include "base/memory/shared_memory.h" |
| #include "base/metrics/field_trial.h" |
| #include "base/metrics/histogram_base.h" |
| #include "base/metrics/statistics_recorder.h" |
| #include "base/path_service.h" |
| #include "base/process/launch.h" |
| #include "base/process/memory.h" |
| +#include "base/process/process.h" |
| #include "base/process/process_handle.h" |
| #include "base/profiler/scoped_tracker.h" |
| #include "base/strings/string_number_conversions.h" |
| @@ -146,12 +148,34 @@ void InitializeFieldTrialAndFeatureList( |
| // Ensure any field trials in browser are reflected into the child |
| // process. |
| + #if defined(OS_WIN) |
| + if (command_line.HasSwitch("field_trial_handle")) { |
| + int field_trial_handle = std::stoi( |
| + command_line.GetSwitchValueASCII("field_trial_handle")); |
| + size_t field_trial_length = std::stoi( |
| + command_line.GetSwitchValueASCII("field_trial_length")); |
|
Alexei Svitkine (slow)
2016/10/03 15:28:05
I suggest using a single flag whose value is the p
lawrencewu
2016/10/03 21:36:11
Done.
|
| + |
| + HANDLE handle = reinterpret_cast<HANDLE>(field_trial_handle); |
| + base::SharedMemoryHandle shm_handle = base::SharedMemoryHandle( |
| + handle, base::GetCurrentProcId()); |
| + |
| + base::SharedMemory shared_memory(shm_handle, false); |
| + shared_memory.Map(field_trial_length); |
| + |
| + char *field_trial_state = static_cast<char*>(shared_memory.memory()); |
| + bool result = base::FieldTrialList::CreateTrialsFromString( |
| + std::string(field_trial_state), |
|
Alexei Svitkine (slow)
2016/10/03 15:28:05
When wrapping indent 4, not 2. You can possibly ju
lawrencewu
2016/10/03 21:36:11
Done. git cl format++
|
| + std::set<std::string>()); |
| + DCHECK(result); |
| + } |
| + #else |
|
Alexei Svitkine (slow)
2016/10/03 15:28:05
Nit: ifdefs shouldn't be indented.
lawrencewu
2016/10/03 21:36:11
Done.
|
| if (command_line.HasSwitch(switches::kForceFieldTrials)) { |
| bool result = base::FieldTrialList::CreateTrialsFromString( |
| - command_line.GetSwitchValueASCII(switches::kForceFieldTrials), |
| - std::set<std::string>()); |
| + command_line.GetSwitchValueASCII(switches::kForceFieldTrials), |
| + std::set<std::string>()); |
| DCHECK(result); |
| } |
| + #endif |
| std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| feature_list->InitializeFromCommandLine( |