| 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..69c1234d38e125e364a6629bb696293abdace9b5 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,7 +148,25 @@ void InitializeFieldTrialAndFeatureList(
|
|
|
| // Ensure any field trials in browser are reflected into the child
|
| // process.
|
| - if (command_line.HasSwitch(switches::kForceFieldTrials)) {
|
| + if (command_line.HasSwitch(switches::kFieldTrialHandle)) {
|
| + std::string arg =
|
| + command_line.GetSwitchValueASCII(switches::kFieldTrialHandle);
|
| + size_t token = arg.find(",");
|
| + int field_trial_handle = std::stoi(arg.substr(0, token));
|
| + int field_trial_length = std::stoi(arg.substr(token + 1, arg.length()));
|
| +
|
| + 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), std::set<std::string>());
|
| + DCHECK(result);
|
| + } else if (command_line.HasSwitch(switches::kForceFieldTrials)) {
|
| bool result = base::FieldTrialList::CreateTrialsFromString(
|
| command_line.GetSwitchValueASCII(switches::kForceFieldTrials),
|
| std::set<std::string>());
|
|
|