Index: base/metrics/field_trial.cc |
=================================================================== |
--- base/metrics/field_trial.cc (revision 118842) |
+++ base/metrics/field_trial.cc (working copy) |
@@ -5,6 +5,7 @@ |
#include "base/metrics/field_trial.h" |
#include "base/build_time.h" |
+#include "base/hash_tables.h" |
#include "base/logging.h" |
#include "base/rand_util.h" |
#include "base/sha1.h" |
@@ -138,6 +139,13 @@ |
return group_name_; |
} |
+bool FieldTrial::GetUID(UID* uid) { |
+ if (group_ == kNotFinalized) |
+ return false; |
+ *uid = std::make_pair(BASE_HASH_NAMESPACE::hash_value(name_), group_); |
jar (doing other things)
2012/01/24 19:19:45
IMO, you should consider generating the hash once
MAD
2012/01/24 20:30:24
Yes, good point, I agree...
Done...
|
+ return true; |
+} |
+ |
// static |
std::string FieldTrial::MakeName(const std::string& name_prefix, |
const std::string& trial_name) { |
@@ -272,6 +280,21 @@ |
} |
// static |
+void FieldTrialList::GetFieldTrialUIDs(std::vector<FieldTrial::UID>* uids) { |
+ if (!global_) |
+ return; |
+ DCHECK(uids->empty()); |
+ AutoLock auto_lock(global_->lock_); |
jar (doing other things)
2012/01/24 19:19:45
This is probably ok. I'm always careful to do as
MAD
2012/01/24 20:30:24
Done...
|
+ |
+ for (RegistrationList::iterator it = global_->registered_.begin(); |
+ it != global_->registered_.end(); ++it) { |
+ FieldTrial::UID uid; |
+ if (it->second->GetUID(&uid)) |
+ uids->push_back(uid); |
+ } |
+} |
+ |
+// static |
bool FieldTrialList::CreateTrialsInChildProcess( |
const std::string& parent_trials) { |
DCHECK(global_); |