Index: base/metrics/field_trial.h |
diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h |
index 2b8894904dd350e94899581bd858506300e83cd7..3851cd8639ebb9763b0b8154dbfbfb51c3869a10 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,26 @@ class BASE_EXPORT FieldTrialList { |
const std::string& trials_string, |
const std::set<std::string>& ignored_trial_names); |
+ // If using shared memory to pass around the list of field trials, then |
Alexei Svitkine (slow)
2016/10/06 13:45:30
The first sentence should describe what the functi
lawrencewu
2016/10/06 20:14:57
Done.
|
+ // expects |field_trial_handle_switch| argument to |
+ // contain the shared memory handle, and it opens the handle, reads the memory |
+ // and creates the trials. |
+ // 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, |
Alexei Svitkine (slow)
2016/10/06 13:45:30
Pass by const& - otherwise you're copying the obje
lawrencewu
2016/10/06 20:14:57
Done.
|
+ 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> CopyFieldTrialStateToSharedMemory( |
+ base::CommandLine* cmd_line, |
+ const char* field_trial_handle_switch); |
+ |
// 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 |