Index: base/metrics/field_trial.h |
diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h |
index 2b8894904dd350e94899581bd858506300e83cd7..99e705a1fa82dd80a34701cbad08e857c589d9f7 100644 |
--- a/base/metrics/field_trial.h |
+++ b/base/metrics/field_trial.h |
@@ -64,9 +64,11 @@ |
#include <vector> |
#include "base/base_export.h" |
+#include "base/command_line.h" |
#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
+#include "base/memory/shared_memory.h" |
#include "base/observer_list_threadsafe.h" |
#include "base/strings/string_piece.h" |
#include "base/synchronization/lock.h" |
@@ -464,6 +466,28 @@ class BASE_EXPORT FieldTrialList { |
const std::string& trials_string, |
const std::set<std::string>& ignored_trial_names); |
+ // Achieves the same thing as CreateTrialsFromString, except wraps the logic |
+ // by taking in the trials from the command line, either via shared memory |
+ // handle or command line argument. |
+ // If using shared memory to pass around the list of field trials, then |
+ // expects |field_trial_handle_switch| command line argument to |
+ // contain the shared memory handle. |
+ // If not, then create the trials as before (using the kForceFieldTrials |
+ // switch). Needs the |field_trial_handle_switch| argument to be passed in |
+ // since base/ can't depend on content/. |
+ static void CreateTrialsFromCommandLine( |
+ const base::CommandLine& cmd_line, |
+ const char* field_trial_handle_switch); |
+ |
+ // 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); |
+ |
// Create a FieldTrial with the given |name| and using 100% probability for |
// the FieldTrial, force FieldTrial to have the same group string as |
// |group_name|. This is commonly used in a non-browser process, to carry |