| Index: base/metrics/field_trial.h
|
| diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h
|
| index 34b9782bee0fe06c51abf1383c3d98c247c4a958..6d446b283ea9703047d3523f99afc22651e4eb3e 100644
|
| --- a/base/metrics/field_trial.h
|
| +++ b/base/metrics/field_trial.h
|
| @@ -513,6 +513,11 @@ class BASE_EXPORT FieldTrialList {
|
| // list of handles to be inherited.
|
| static void AppendFieldTrialHandleIfNeeded(
|
| base::HandlesToInheritVector* handles);
|
| +#elif defined(OS_POSIX)
|
| + // On POSIX, we also need to explicitly pass down this file descriptor that
|
| + // should be shared with the child process. Returns kInvalidPlatformFile if no
|
| + // handle exists or was not initialized properly.
|
| + static PlatformFile GetFieldTrialHandle();
|
| #endif
|
|
|
| // Adds a switch to the command line containing the field trial state as a
|
| @@ -557,12 +562,14 @@ class BASE_EXPORT FieldTrialList {
|
| FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest,
|
| DoNotAddSimulatedFieldTrialsToAllocator);
|
|
|
| -#if defined(OS_WIN)
|
| - // Takes in |handle| that should have been retrieved from the command line and
|
| - // creates a SharedMemoryHandle from it, and then calls
|
| - // CreateTrialsFromSharedMemory(). Returns true on success, false on failure.
|
| - static bool CreateTrialsFromWindowsHandle(HANDLE handle);
|
| -#endif
|
| + // Takes in |handle_switch| from the command line which represents the shared
|
| + // memory handle for field trials, parses it, and creates the field trials.
|
| + // Returns true on success, false on failure.
|
| + static bool CreateTrialsFromHandleSwitch(const std::string& handle_switch);
|
| +
|
| + // Takes an unmapped SharedMemoryHandle, creates a SharedMemory object from it
|
| + // and maps it with the correct size.
|
| + static bool CreateTrialsFromSharedMemoryHandle(SharedMemoryHandle shm_handle);
|
|
|
| // 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.
|
| @@ -627,12 +634,10 @@ class BASE_EXPORT FieldTrialList {
|
| // to start passing more data other than field trials.
|
| std::unique_ptr<FieldTrialAllocator> field_trial_allocator_ = nullptr;
|
|
|
| -#if defined(OS_WIN)
|
| // Readonly copy of the handle to the allocator. Needs to be a member variable
|
| // because it's needed from both CopyFieldTrialStateToFlags() and
|
| // AppendFieldTrialHandleIfNeeded().
|
| - HANDLE readonly_allocator_handle_ = nullptr;
|
| -#endif
|
| + PlatformFile readonly_allocator_handle_ = kInvalidPlatformFile;
|
|
|
| // Tracks whether CreateTrialsFromCommandLine() has been called.
|
| bool create_trials_from_command_line_called_ = false;
|
|
|