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

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

Issue 238443008: Make VariationsService simulate received seeds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 // Remove an observer. 437 // Remove an observer.
438 static void RemoveObserver(Observer* observer); 438 static void RemoveObserver(Observer* observer);
439 439
440 // Notify all observers that a group has been finalized for |field_trial|. 440 // Notify all observers that a group has been finalized for |field_trial|.
441 static void NotifyFieldTrialGroupSelection(FieldTrial* field_trial); 441 static void NotifyFieldTrialGroupSelection(FieldTrial* field_trial);
442 442
443 // Return the number of active field trials. 443 // Return the number of active field trials.
444 static size_t GetFieldTrialCount(); 444 static size_t GetFieldTrialCount();
445 445
446 // If one-time randomization is enabled, returns a weak pointer to the
447 // corresponding EntropyProvider. Otherwise, returns NULL. The returned
448 // entropy provider is owned by the global FieldTrialList and is guaranteed to
449 // remain valid until the global FieldTrialList is destroyed.
450 static const FieldTrial::EntropyProvider*
451 GetEntropyProviderForOneTimeRandomization();
452
446 private: 453 private:
447 // A map from FieldTrial names to the actual instances. 454 // A map from FieldTrial names to the actual instances.
448 typedef std::map<std::string, FieldTrial*> RegistrationMap; 455 typedef std::map<std::string, FieldTrial*> RegistrationMap;
449 456
450 // If one-time randomization is enabled, returns a weak pointer to the
451 // corresponding EntropyProvider. Otherwise, returns NULL.
452 static const FieldTrial::EntropyProvider*
453 GetEntropyProviderForOneTimeRandomization();
454
455 // Helper function should be called only while holding lock_. 457 // Helper function should be called only while holding lock_.
456 FieldTrial* PreLockedFind(const std::string& name); 458 FieldTrial* PreLockedFind(const std::string& name);
457 459
458 // Register() stores a pointer to the given trial in a global map. 460 // Register() stores a pointer to the given trial in a global map.
459 // This method also AddRef's the indicated trial. 461 // This method also AddRef's the indicated trial.
460 // This should always be called after creating a new FieldTrial instance. 462 // This should always be called after creating a new FieldTrial instance.
461 static void Register(FieldTrial* trial); 463 static void Register(FieldTrial* trial);
462 464
463 static FieldTrialList* global_; // The singleton of this class. 465 static FieldTrialList* global_; // The singleton of this class.
464 466
(...skipping 13 matching lines...) Expand all
478 480
479 // List of observers to be notified when a group is selected for a FieldTrial. 481 // List of observers to be notified when a group is selected for a FieldTrial.
480 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; 482 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_;
481 483
482 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); 484 DISALLOW_COPY_AND_ASSIGN(FieldTrialList);
483 }; 485 };
484 486
485 } // namespace base 487 } // namespace base
486 488
487 #endif // BASE_METRICS_FIELD_TRIAL_H_ 489 #endif // BASE_METRICS_FIELD_TRIAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698