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

Unified Diff: base/metrics/field_trial.h

Issue 2463223002: Store field trial parameters in shared memory (Closed)
Patch Set: fix failing tests due to lock Created 4 years, 1 month 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 34b9782bee0fe06c51abf1383c3d98c247c4a958..3a5a71c60761675ec3c6a8370e6a822c4d2ff8f1 100644
--- a/base/metrics/field_trial.h
+++ b/base/metrics/field_trial.h
@@ -228,6 +228,8 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> {
friend class RefCounted<FieldTrial>;
+ friend class FieldTrialParamAssociator;
Alexei Svitkine (slow) 2016/11/24 17:56:32 Can this be removed?
lawrencewu 2016/11/24 21:50:36 Yes, I think so. Removed.
+
// This is the group number of the 'default' group when a choice wasn't forced
// by a call to FieldTrialList::CreateFieldTrial. It is kept private so that
// consumers don't use it by mistake in cases where the group was forced.
@@ -550,12 +552,22 @@ class BASE_EXPORT FieldTrialList {
// Return the number of active field trials.
static size_t GetFieldTrialCount();
+ // Gets the parameters for |field_trial| from shared memory and stores them in
+ // |params|.
Alexei Svitkine (slow) 2016/11/24 17:56:32 Add a second sentence mentioning that this is expo
lawrencewu 2016/11/24 21:50:36 Done.
+ static bool GetParamsFromSharedMemory(
+ FieldTrial* field_trial,
+ std::map<std::string, std::string>* params);
+
+ // Clears all the params in the allocator.
+ static void ClearParamsFromSharedMemoryForTesting();
+
private:
// Allow tests to access our innards for testing purposes.
FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, InstantiateAllocator);
FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, AddTrialsToAllocator);
FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest,
DoNotAddSimulatedFieldTrialsToAllocator);
+ FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, AssociateFieldTrialParams);
#if defined(OS_WIN)
// Takes in |handle| that should have been retrieved from the command line and
@@ -608,8 +620,8 @@ class BASE_EXPORT FieldTrialList {
// FieldTrialList is created after that.
static bool used_without_global_;
- // Lock for access to registered_.
- base::Lock lock_;
+ // Lock for access to registered_ and field_trial_allocator_.
+ Lock lock_;
RegistrationMap registered_;
std::map<std::string, std::string> seen_states_;
« 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