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

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

Issue 7027040: Implement A/B experiment for anti-DDoS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Extend trial cut-off date to July 23rd. Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/browser_main.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) 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // static 362 // static
363 size_t FieldTrialList::GetFieldTrialCount() { 363 size_t FieldTrialList::GetFieldTrialCount() {
364 if (!global_) 364 if (!global_)
365 return 0; 365 return 0;
366 AutoLock auto_lock(global_->lock_); 366 AutoLock auto_lock(global_->lock_);
367 return global_->registered_.size(); 367 return global_->registered_.size();
368 } 368 }
369 369
370 // static 370 // static
371 bool FieldTrialList::IsOneTimeRandomizationEnabled() { 371 bool FieldTrialList::IsOneTimeRandomizationEnabled() {
372 DCHECK(global_); 372 // TODO(joi): Put back a DCHECK(global_) here. First, need to make sure all
373 // unit test executables have exactly one FieldTrialList instance (currently
374 // they have 0 or 1).
373 if (!global_) 375 if (!global_)
374 return false; 376 return false;
375 377
376 return !global_->client_id_.empty(); 378 return !global_->client_id_.empty();
377 } 379 }
378 380
379 // static 381 // static
380 const std::string& FieldTrialList::client_id() { 382 const std::string& FieldTrialList::client_id() {
381 DCHECK(global_); 383 DCHECK(global_);
382 if (!global_) 384 if (!global_)
383 return EmptyString(); 385 return EmptyString();
384 386
385 return global_->client_id_; 387 return global_->client_id_;
386 } 388 }
387 389
388 FieldTrial* FieldTrialList::PreLockedFind(const std::string& name) { 390 FieldTrial* FieldTrialList::PreLockedFind(const std::string& name) {
389 RegistrationList::iterator it = registered_.find(name); 391 RegistrationList::iterator it = registered_.find(name);
390 if (registered_.end() == it) 392 if (registered_.end() == it)
391 return NULL; 393 return NULL;
392 return it->second; 394 return it->second;
393 } 395 }
394 396
395 } // namespace base 397 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698