Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2078)

Unified Diff: base/metrics/field_trial.h

Issue 2365273004: Initial implementation for sharing field trial state (win) (Closed)
Patch Set: Address comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | base/metrics/field_trial.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | base/metrics/field_trial.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698