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

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

Issue 1810593002: Call CheckTrialGroup only under lock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/build_time.h" 9 #include "base/build_time.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 { 608 {
609 AutoLock auto_lock(global_->lock_); 609 AutoLock auto_lock(global_->lock_);
610 if (field_trial->group_reported_) 610 if (field_trial->group_reported_)
611 return; 611 return;
612 field_trial->group_reported_ = true; 612 field_trial->group_reported_ = true;
613 } 613 }
614 614
615 if (!field_trial->enable_field_trial_) 615 if (!field_trial->enable_field_trial_)
616 return; 616 return;
617 617
618 CheckTrialGroup(field_trial->trial_name(), field_trial->group_name_internal(), 618 {
619 &global_->seen_states_); 619 AutoLock auto_lock(global_->lock_);
620 CheckTrialGroup(field_trial->trial_name(),
621 field_trial->group_name_internal(), &global_->seen_states_);
622 }
620 global_->observer_list_->Notify( 623 global_->observer_list_->Notify(
621 FROM_HERE, &FieldTrialList::Observer::OnFieldTrialGroupFinalized, 624 FROM_HERE, &FieldTrialList::Observer::OnFieldTrialGroupFinalized,
622 field_trial->trial_name(), field_trial->group_name_internal()); 625 field_trial->trial_name(), field_trial->group_name_internal());
623 } 626 }
624 627
625 // static 628 // static
626 size_t FieldTrialList::GetFieldTrialCount() { 629 size_t FieldTrialList::GetFieldTrialCount() {
627 if (!global_) 630 if (!global_)
628 return 0; 631 return 0;
629 AutoLock auto_lock(global_->lock_); 632 AutoLock auto_lock(global_->lock_);
(...skipping 25 matching lines...) Expand all
655 return; 658 return;
656 } 659 }
657 AutoLock auto_lock(global_->lock_); 660 AutoLock auto_lock(global_->lock_);
658 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); 661 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name();
659 trial->AddRef(); 662 trial->AddRef();
660 trial->SetTrialRegistered(); 663 trial->SetTrialRegistered();
661 global_->registered_[trial->trial_name()] = trial; 664 global_->registered_[trial->trial_name()] = trial;
662 } 665 }
663 666
664 } // namespace base 667 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698