| Index: base/metrics/field_trial.h
|
| diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h
|
| index 99e705a1fa82dd80a34701cbad08e857c589d9f7..c1407f9bc34db965cea113eda1e0ab1713200ebc 100644
|
| --- a/base/metrics/field_trial.h
|
| +++ b/base/metrics/field_trial.h
|
| @@ -69,7 +69,9 @@
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/shared_memory.h"
|
| +#include "base/metrics/persistent_memory_allocator.h"
|
| #include "base/observer_list_threadsafe.h"
|
| +#include "base/process/launch.h"
|
| #include "base/strings/string_piece.h"
|
| #include "base/synchronization/lock.h"
|
| #include "base/time/time.h"
|
| @@ -479,14 +481,18 @@ class BASE_EXPORT FieldTrialList {
|
| const base::CommandLine& cmd_line,
|
| const char* field_trial_handle_switch);
|
|
|
| +#if defined(OS_WIN)
|
| + static void AppendFieldTrialHandleIfNeeded(
|
| + base::HandlesToInheritVector& handles);
|
| +#endif
|
| +
|
| // Adds a switch to the command line containing the field trial state as a
|
| // string (if not using shared memory to share field trial state), or the
|
| // shared memory handle + length.
|
| // Needs the |field_trial_handle_switch| argument to be passed in since base/
|
| // can't depend on content/.
|
| - static std::unique_ptr<base::SharedMemory> CopyFieldTrialStateToFlags(
|
| - const char* field_trial_handle_switch,
|
| - base::CommandLine* cmd_line);
|
| + static void CopyFieldTrialStateToFlags(const char* field_trial_handle_switch,
|
| + base::CommandLine* cmd_line);
|
|
|
| // Create a FieldTrial with the given |name| and using 100% probability for
|
| // the FieldTrial, force FieldTrial to have the same group string as
|
| @@ -508,10 +514,26 @@ class BASE_EXPORT FieldTrialList {
|
| // Notify all observers that a group has been finalized for |field_trial|.
|
| static void NotifyFieldTrialGroupSelection(FieldTrial* field_trial);
|
|
|
| + // Called in NotifyFieldTrialGroupSelection(). Updates field_trial_allocator
|
| + // by adding the newly-created |field_trial|.
|
| + static void UpdateFieldTrialAllocator(FieldTrial* field_trial);
|
| +
|
| // Return the number of active field trials.
|
| static size_t GetFieldTrialCount();
|
|
|
| private:
|
| + // Expects a mapped piece of shared memory |shm| that was created from the
|
| + // browser process's field_trial_allocator and shared via the command line.
|
| + // This function recreates the allocator, iterates through all the field
|
| + // trials in it, and creates them via CreateFieldTrial().
|
| + static void CreateTrialsFromSharedMemory(
|
| + std::unique_ptr<base::SharedMemory> shm);
|
| +
|
| + // Allocator used to instantiate field trial in child processes. In the
|
| + // future, we may want to move this to a more generic place if we want to
|
| + // start passing more data other than field trials.
|
| + static base::SharedPersistentMemoryAllocator* field_trial_allocator;
|
| +
|
| // A map from FieldTrial names to the actual instances.
|
| typedef std::map<std::string, FieldTrial*> RegistrationMap;
|
|
|
|
|