| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/metrics/field_trial.h" | 5 #include "base/metrics/field_trial.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
| 9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 DCHECK_EQ(0u, FieldTrialList::GetFieldTrialCount()); | 150 DCHECK_EQ(0u, FieldTrialList::GetFieldTrialCount()); |
| 151 enable_benchmarking_ = true; | 151 enable_benchmarking_ = true; |
| 152 } | 152 } |
| 153 | 153 |
| 154 FieldTrial::~FieldTrial() {} | 154 FieldTrial::~FieldTrial() {} |
| 155 | 155 |
| 156 // static | 156 // static |
| 157 Time FieldTrial::GetBuildTime() { | 157 Time FieldTrial::GetBuildTime() { |
| 158 Time integral_build_time; | 158 Time integral_build_time; |
| 159 const char* kDateTime = __DATE__ " " __TIME__; | 159 const char* kDateTime = __DATE__ " " __TIME__; |
| 160 bool result = Time::FromString(ASCIIToWide(kDateTime).c_str(), | 160 bool result = Time::FromString(kDateTime, &integral_build_time); |
| 161 &integral_build_time); | |
| 162 DCHECK(result); | 161 DCHECK(result); |
| 163 return integral_build_time; | 162 return integral_build_time; |
| 164 } | 163 } |
| 165 | 164 |
| 166 // static | 165 // static |
| 167 double FieldTrial::HashClientId(const std::string& client_id, | 166 double FieldTrial::HashClientId(const std::string& client_id, |
| 168 const std::string& trial_name) { | 167 const std::string& trial_name) { |
| 169 // SHA-1 is designed to produce a uniformly random spread in its output space, | 168 // SHA-1 is designed to produce a uniformly random spread in its output space, |
| 170 // even for nearly-identical inputs, so it helps massage whatever client_id | 169 // even for nearly-identical inputs, so it helps massage whatever client_id |
| 171 // and trial_name we get into something with a uniform distribution, which | 170 // and trial_name we get into something with a uniform distribution, which |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 } | 386 } |
| 388 | 387 |
| 389 FieldTrial* FieldTrialList::PreLockedFind(const std::string& name) { | 388 FieldTrial* FieldTrialList::PreLockedFind(const std::string& name) { |
| 390 RegistrationList::iterator it = registered_.find(name); | 389 RegistrationList::iterator it = registered_.find(name); |
| 391 if (registered_.end() == it) | 390 if (registered_.end() == it) |
| 392 return NULL; | 391 return NULL; |
| 393 return it->second; | 392 return it->second; |
| 394 } | 393 } |
| 395 | 394 |
| 396 } // namespace base | 395 } // namespace base |
| OLD | NEW |