summaryrefslogtreecommitdiffstats
path: root/base/field_trial.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-23 02:45:11 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-23 02:45:11 +0000
commit0b48db4400f9a20de3c9f5bea099c1a3cbcf5015 (patch)
treec7149e77252a1fe846a87cf93c1b98a02fe53296 /base/field_trial.h
parent202dee0077b3756f5fad43c521ceec4f7349c91e (diff)
downloadchromium_src-0b48db4400f9a20de3c9f5bea099c1a3cbcf5015.zip
chromium_src-0b48db4400f9a20de3c9f5bea099c1a3cbcf5015.tar.gz
chromium_src-0b48db4400f9a20de3c9f5bea099c1a3cbcf5015.tar.bz2
Attempt to detect impact of disabling dns prefetching on transaction latency
This is also meant to exercise the field trial infrastructure. r=mbelshe Review URL: http://codereview.chromium.org/50084 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12271 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/field_trial.h')
-rw-r--r--base/field_trial.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/base/field_trial.h b/base/field_trial.h
index bde6717..3d922d1 100644
--- a/base/field_trial.h
+++ b/base/field_trial.h
@@ -47,7 +47,7 @@
// happened (randomly) to be assigned to:
// HISTOGRAM_COUNTS(FieldTrial::MakeName("Memory.RendererTotal",
-// "MemoryExperiment"), count);
+// "MemoryExperiment").data(), count);
// The above code will create 3 distinct histograms, with each run of the
// application being assigned to of of teh three groups, and for each group, the
@@ -65,6 +65,7 @@
#include <map>
#include <string>
+#include "base/lock.h"
#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "base/time.h"
@@ -140,7 +141,7 @@ class FieldTrial : public base::RefCounted<FieldTrial> {
// Class with a list of all active field trials. A trial is active if it has
// been registered, which includes evaluating its state based on its probaility.
// Only one instance of this class exists.
-class FieldTrialList : NonThreadSafe {
+class FieldTrialList {
public:
// This singleton holds the global list of registered FieldTrials.
FieldTrialList();
@@ -172,11 +173,17 @@ class FieldTrialList : NonThreadSafe {
}
private:
+ // Helper function should be called only while holding lock_.
+ FieldTrial* PreLockedFind(const std::string& name);
+
typedef std::map<std::string, FieldTrial*> RegistrationList;
static FieldTrialList* global_; // The singleton of this class.
base::Time application_start_time_;
+
+ // Lock for access to registered_.
+ Lock lock_;
RegistrationList registered_;
DISALLOW_COPY_AND_ASSIGN(FieldTrialList);