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

Side by Side Diff: base/metrics/field_trial.h

Issue 2517193003: Fix adding duplicate trials to allocator (finally) (Closed)
Patch Set: git rebase-update 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // FieldTrial is a class for handling details of statistical experiments 5 // FieldTrial is a class for handling details of statistical experiments
6 // performed by actual users in the field (i.e., in a shipped or beta product). 6 // performed by actual users in the field (i.e., in a shipped or beta product).
7 // All code is called exclusively on the UI thread currently. 7 // All code is called exclusively on the UI thread currently.
8 // 8 //
9 // The simplest example is an experiment to see whether one of two options 9 // The simplest example is an experiment to see whether one of two options
10 // produces "better" results across our user population. In that scenario, UMA 10 // produces "better" results across our user population. In that scenario, UMA
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, ActiveGroupsNotFinalized); 214 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, ActiveGroupsNotFinalized);
215 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, Save); 215 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, Save);
216 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SaveAll); 216 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SaveAll);
217 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, DuplicateRestore); 217 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, DuplicateRestore);
218 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedTurnFeatureOff); 218 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedTurnFeatureOff);
219 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedTurnFeatureOn); 219 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedTurnFeatureOn);
220 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedChangeDefault_Default); 220 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedChangeDefault_Default);
221 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedChangeDefault_NonDefault); 221 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedChangeDefault_NonDefault);
222 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, FloatBoundariesGiveEqualGroupSizes); 222 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, FloatBoundariesGiveEqualGroupSizes);
223 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, DoesNotSurpassTotalProbability); 223 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, DoesNotSurpassTotalProbability);
224 FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest,
225 DoNotAddSimulatedFieldTrialsToAllocator);
224 226
225 friend class base::FieldTrialList; 227 friend class base::FieldTrialList;
226 228
227 friend class RefCounted<FieldTrial>; 229 friend class RefCounted<FieldTrial>;
228 230
229 // This is the group number of the 'default' group when a choice wasn't forced 231 // This is the group number of the 'default' group when a choice wasn't forced
230 // by a call to FieldTrialList::CreateFieldTrial. It is kept private so that 232 // by a call to FieldTrialList::CreateFieldTrial. It is kept private so that
231 // consumers don't use it by mistake in cases where the group was forced. 233 // consumers don't use it by mistake in cases where the group was forced.
232 static const int kDefaultGroupNumber; 234 static const int kDefaultGroupNumber;
233 235
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // Notify all observers that a group has been finalized for |field_trial|. 547 // Notify all observers that a group has been finalized for |field_trial|.
546 static void NotifyFieldTrialGroupSelection(FieldTrial* field_trial); 548 static void NotifyFieldTrialGroupSelection(FieldTrial* field_trial);
547 549
548 // Return the number of active field trials. 550 // Return the number of active field trials.
549 static size_t GetFieldTrialCount(); 551 static size_t GetFieldTrialCount();
550 552
551 private: 553 private:
552 // Allow tests to access our innards for testing purposes. 554 // Allow tests to access our innards for testing purposes.
553 FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, InstantiateAllocator); 555 FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, InstantiateAllocator);
554 FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, AddTrialsToAllocator); 556 FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, AddTrialsToAllocator);
557 FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest,
558 DoNotAddSimulatedFieldTrialsToAllocator);
555 559
556 #if defined(OS_WIN) 560 #if defined(OS_WIN)
557 // Takes in |handle| that should have been retrieved from the command line and 561 // Takes in |handle| that should have been retrieved from the command line and
558 // creates a SharedMemoryHandle from it, and then calls 562 // creates a SharedMemoryHandle from it, and then calls
559 // CreateTrialsFromSharedMemory(). Returns true on success, false on failure. 563 // CreateTrialsFromSharedMemory(). Returns true on success, false on failure.
560 static bool CreateTrialsFromWindowsHandle(HANDLE handle); 564 static bool CreateTrialsFromWindowsHandle(HANDLE handle);
561 #endif 565 #endif
562 566
563 // Expects a mapped piece of shared memory |shm| that was created from the 567 // Expects a mapped piece of shared memory |shm| that was created from the
564 // browser process's field_trial_allocator and shared via the command line. 568 // browser process's field_trial_allocator and shared via the command line.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 636
633 // Tracks whether CreateTrialsFromCommandLine() has been called. 637 // Tracks whether CreateTrialsFromCommandLine() has been called.
634 bool create_trials_from_command_line_called_ = false; 638 bool create_trials_from_command_line_called_ = false;
635 639
636 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); 640 DISALLOW_COPY_AND_ASSIGN(FieldTrialList);
637 }; 641 };
638 642
639 } // namespace base 643 } // namespace base
640 644
641 #endif // BASE_METRICS_FIELD_TRIAL_H_ 645 #endif // BASE_METRICS_FIELD_TRIAL_H_
OLDNEW
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698