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

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

Issue 10165014: Add and implement API to associate Google experiment IDs with FieldTrials. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: added time variable Created 8 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
« no previous file with comments | « base/metrics/field_trial.h ('k') | chrome/browser/metrics/field_trial_synchronizer.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 #include "base/metrics/field_trial.h" 5 #include "base/metrics/field_trial.h"
6 6
7 #include "base/build_time.h" 7 #include "base/build_time.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 // static 161 // static
162 std::string FieldTrial::MakeName(const std::string& name_prefix, 162 std::string FieldTrial::MakeName(const std::string& name_prefix,
163 const std::string& trial_name) { 163 const std::string& trial_name) {
164 std::string big_string(name_prefix); 164 std::string big_string(name_prefix);
165 big_string.append(1, kHistogramFieldTrialSeparator); 165 big_string.append(1, kHistogramFieldTrialSeparator);
166 return big_string.append(FieldTrialList::FindFullName(trial_name)); 166 return big_string.append(FieldTrialList::FindFullName(trial_name));
167 } 167 }
168 168
169 // static 169 // static
170 FieldTrial::NameGroupId FieldTrial::MakeNameGroupId(
171 const std::string& trial_name,
172 const std::string& group_name) {
173 NameGroupId id;
174 id.name = HashName(trial_name);
175 id.group = HashName(group_name);
176 return id;
177 }
178
179 // static
170 void FieldTrial::EnableBenchmarking() { 180 void FieldTrial::EnableBenchmarking() {
171 DCHECK_EQ(0u, FieldTrialList::GetFieldTrialCount()); 181 DCHECK_EQ(0u, FieldTrialList::GetFieldTrialCount());
172 enable_benchmarking_ = true; 182 enable_benchmarking_ = true;
173 } 183 }
174 184
175 FieldTrial::~FieldTrial() {} 185 FieldTrial::~FieldTrial() {}
176 186
177 void FieldTrial::SetGroupChoice(const std::string& name, int number) { 187 void FieldTrial::SetGroupChoice(const std::string& name, int number) {
178 group_ = number; 188 group_ = number;
179 if (name.empty()) 189 if (name.empty())
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 used_without_global_ = true; 486 used_without_global_ = true;
477 return; 487 return;
478 } 488 }
479 AutoLock auto_lock(global_->lock_); 489 AutoLock auto_lock(global_->lock_);
480 DCHECK(!global_->PreLockedFind(trial->name())); 490 DCHECK(!global_->PreLockedFind(trial->name()));
481 trial->AddRef(); 491 trial->AddRef();
482 global_->registered_[trial->name()] = trial; 492 global_->registered_[trial->name()] = trial;
483 } 493 }
484 494
485 } // namespace base 495 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/field_trial.h ('k') | chrome/browser/metrics/field_trial_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698