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

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

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