Index: base/metrics/field_trial.h |
diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h |
index 34b9782bee0fe06c51abf1383c3d98c247c4a958..658ca1187613348e74683c12d505847a3c176366 100644 |
--- a/base/metrics/field_trial.h |
+++ b/base/metrics/field_trial.h |
@@ -513,6 +513,12 @@ 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 any fds to be inherited via |
+ // |files_to_register| in child_process_launcher.cc. This gets the handle so |
Alexei Svitkine (slow)
2016/11/24 17:44:34
I don't think this should mention child_process_la
lawrencewu
2016/11/24 18:16:13
Done.
|
+ // we can add it to the mapping there. Returns -1 if no handle exists or was |
+ // not initialized properly. |
+ static int GetFieldTrialHandle(); |
#endif |
// Adds a switch to the command line containing the field trial state as a |
@@ -557,12 +563,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. |
@@ -632,6 +640,8 @@ class BASE_EXPORT FieldTrialList { |
// because it's needed from both CopyFieldTrialStateToFlags() and |
// AppendFieldTrialHandleIfNeeded(). |
HANDLE readonly_allocator_handle_ = nullptr; |
+#elif defined(OS_POSIX) |
+ int readonly_allocator_handle_ = -1; |
Alexei Svitkine (slow)
2016/11/24 17:44:34
Hmm, how about having this be the same var on Win
lawrencewu
2016/11/24 18:16:13
That's much cleaner, done.
|
#endif |
// Tracks whether CreateTrialsFromCommandLine() has been called. |