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

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

Issue 1538743002: Switch to standard integer types in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS roll too Created 4 years, 11 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
« no previous file with comments | « base/metrics/bucket_ranges_unittest.cc ('k') | 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // if (trial->group() == high_mem_group) 47 // if (trial->group() == high_mem_group)
48 // SetPruningAlgorithm(kType1); // Sample setting of browser state. 48 // SetPruningAlgorithm(kType1); // Sample setting of browser state.
49 // else if (trial->group() == low_mem_group) 49 // else if (trial->group() == low_mem_group)
50 // SetPruningAlgorithm(kType2); // Sample alternate setting. 50 // SetPruningAlgorithm(kType2); // Sample alternate setting.
51 51
52 //------------------------------------------------------------------------------ 52 //------------------------------------------------------------------------------
53 53
54 #ifndef BASE_METRICS_FIELD_TRIAL_H_ 54 #ifndef BASE_METRICS_FIELD_TRIAL_H_
55 #define BASE_METRICS_FIELD_TRIAL_H_ 55 #define BASE_METRICS_FIELD_TRIAL_H_
56 56
57 #include <stddef.h>
58 #include <stdint.h>
59
57 #include <map> 60 #include <map>
58 #include <set> 61 #include <set>
59 #include <string> 62 #include <string>
60 #include <vector> 63 #include <vector>
61 64
62 #include "base/base_export.h" 65 #include "base/base_export.h"
63 #include "base/gtest_prod_util.h" 66 #include "base/gtest_prod_util.h"
67 #include "base/macros.h"
64 #include "base/memory/ref_counted.h" 68 #include "base/memory/ref_counted.h"
65 #include "base/observer_list_threadsafe.h" 69 #include "base/observer_list_threadsafe.h"
66 #include "base/synchronization/lock.h" 70 #include "base/synchronization/lock.h"
67 #include "base/time/time.h" 71 #include "base/time/time.h"
68 72
69 namespace base { 73 namespace base {
70 74
71 class FieldTrialList; 75 class FieldTrialList;
72 76
73 class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { 77 class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> {
(...skipping 16 matching lines...) Expand all
90 class BASE_EXPORT EntropyProvider { 94 class BASE_EXPORT EntropyProvider {
91 public: 95 public:
92 virtual ~EntropyProvider(); 96 virtual ~EntropyProvider();
93 97
94 // Returns a double in the range of [0, 1) to be used for the dice roll for 98 // Returns a double in the range of [0, 1) to be used for the dice roll for
95 // the specified field trial. If |randomization_seed| is not 0, it will be 99 // the specified field trial. If |randomization_seed| is not 0, it will be
96 // used in preference to |trial_name| for generating the entropy by entropy 100 // used in preference to |trial_name| for generating the entropy by entropy
97 // providers that support it. A given instance should always return the same 101 // providers that support it. A given instance should always return the same
98 // value given the same input |trial_name| and |randomization_seed| values. 102 // value given the same input |trial_name| and |randomization_seed| values.
99 virtual double GetEntropyForTrial(const std::string& trial_name, 103 virtual double GetEntropyForTrial(const std::string& trial_name,
100 uint32 randomization_seed) const = 0; 104 uint32_t randomization_seed) const = 0;
101 }; 105 };
102 106
103 // A pair representing a Field Trial and its selected group. 107 // A pair representing a Field Trial and its selected group.
104 struct ActiveGroup { 108 struct ActiveGroup {
105 std::string trial_name; 109 std::string trial_name;
106 std::string group_name; 110 std::string group_name;
107 }; 111 };
108 112
109 // A triplet representing a FieldTrial, its selected group and whether it's 113 // A triplet representing a FieldTrial, its selected group and whether it's
110 // active. 114 // active.
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // Note: Using a custom randomization seed is only supported by the 395 // Note: Using a custom randomization seed is only supported by the
392 // PermutedEntropyProvider (which is used when UMA is not enabled). 396 // PermutedEntropyProvider (which is used when UMA is not enabled).
393 static FieldTrial* FactoryGetFieldTrialWithRandomizationSeed( 397 static FieldTrial* FactoryGetFieldTrialWithRandomizationSeed(
394 const std::string& trial_name, 398 const std::string& trial_name,
395 FieldTrial::Probability total_probability, 399 FieldTrial::Probability total_probability,
396 const std::string& default_group_name, 400 const std::string& default_group_name,
397 const int year, 401 const int year,
398 const int month, 402 const int month,
399 const int day_of_month, 403 const int day_of_month,
400 FieldTrial::RandomizationType randomization_type, 404 FieldTrial::RandomizationType randomization_type,
401 uint32 randomization_seed, 405 uint32_t randomization_seed,
402 int* default_group_number); 406 int* default_group_number);
403 407
404 // The Find() method can be used to test to see if a named trial was already 408 // The Find() method can be used to test to see if a named trial was already
405 // registered, or to retrieve a pointer to it from the global map. 409 // registered, or to retrieve a pointer to it from the global map.
406 static FieldTrial* Find(const std::string& trial_name); 410 static FieldTrial* Find(const std::string& trial_name);
407 411
408 // Returns the group number chosen for the named trial, or 412 // Returns the group number chosen for the named trial, or
409 // FieldTrial::kNotFinalized if the trial does not exist. 413 // FieldTrial::kNotFinalized if the trial does not exist.
410 static int FindValue(const std::string& trial_name); 414 static int FindValue(const std::string& trial_name);
411 415
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 525
522 // List of observers to be notified when a group is selected for a FieldTrial. 526 // List of observers to be notified when a group is selected for a FieldTrial.
523 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; 527 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_;
524 528
525 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); 529 DISALLOW_COPY_AND_ASSIGN(FieldTrialList);
526 }; 530 };
527 531
528 } // namespace base 532 } // namespace base
529 533
530 #endif // BASE_METRICS_FIELD_TRIAL_H_ 534 #endif // BASE_METRICS_FIELD_TRIAL_H_
OLDNEW
« no previous file with comments | « base/metrics/bucket_ranges_unittest.cc ('k') | base/metrics/field_trial.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698