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

Unified Diff: base/metrics/field_trial.h

Issue 2449143002: Actually update FieldTrialEntry's activated field (Closed)
Patch Set: add to the allocator if it's null 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 e975150cba38378a14c9224636d020cb5ea7a767..30b057da4069a37b25ea7fafd92f3344d62c385b 100644
--- a/base/metrics/field_trial.h
+++ b/base/metrics/field_trial.h
@@ -269,8 +269,7 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> {
// Adds the field trial to the allocator whose memory is to be shared with
// child processes. Assumes the calling code has a lock around the call to
// this function, since the check for the allocator is not thread-safe.
- void AddToAllocatorWhileLocked(
- base::SharedPersistentMemoryAllocator* allocator);
+ void AddToAllocatorWhileLocked(SharedPersistentMemoryAllocator* allocator);
// Returns the group_name. A winner need not have been chosen.
std::string group_name_internal() const { return group_name_; }
@@ -323,6 +322,9 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> {
// group.
static bool enable_benchmarking_;
+ // Reference to related field trial struct and data in shared memory.
+ SharedPersistentMemoryAllocator::Reference ref_;
Alexei Svitkine (slow) 2016/10/25 19:18:53 Nit: Move this above the static var above - so all
lawrencewu 2016/10/25 20:27:33 Done.
+
DISALLOW_COPY_AND_ASSIGN(FieldTrial);
};
@@ -526,6 +528,9 @@ class BASE_EXPORT FieldTrialList {
// Return the number of active field trials.
static size_t GetFieldTrialCount();
+ // Return the field trial allocator (for adding to it).
+ static SharedPersistentMemoryAllocator* GetFieldTrialAllocator();
+
private:
// Allow tests to access our innards for testing purposes.
FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, InstantiateAllocator);
@@ -583,8 +588,8 @@ class BASE_EXPORT FieldTrialList {
// Allocator used to instantiate field trial in child processes. In the
// future, we may want to move this to a more generic place if we want to
// start passing more data other than field trials.
- std::unique_ptr<base::SharedPersistentMemoryAllocator>
- field_trial_allocator_ = nullptr;
+ std::unique_ptr<SharedPersistentMemoryAllocator> field_trial_allocator_ =
+ nullptr;
#if defined(OS_WIN)
// Readonly copy of the handle to the allocator. Needs to be a member variable
« 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