diff options
author | asvitkine <asvitkine@chromium.org> | 2016-02-12 11:21:20 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-12 19:22:22 +0000 |
commit | 8e8a03dbf4d42a44c4ade6c9566256ad815832ed (patch) | |
tree | a1faec9ed48a01ba73a5cb46e7ddaf56c1e9f74b /base | |
parent | 243a025a6eb1318aa715a05a426eba7ab51eed19 (diff) | |
download | chromium_src-8e8a03dbf4d42a44c4ade6c9566256ad815832ed.zip chromium_src-8e8a03dbf4d42a44c4ade6c9566256ad815832ed.tar.gz chromium_src-8e8a03dbf4d42a44c4ade6c9566256ad815832ed.tar.bz2 |
Add code to FieldTrialList to help diagnose a renderer crash.
We're seeing inconsistencies between what state renderers received
on the command-line vs. what they later get via IPC. This change
adds checks on the browser side that would detect when this happens
- by keeping a map of the field trial states that were sent on the
command-line or sent via IPC and CHECK'ing when there's a mismatch.
This will hopefully provide a stack trace when this happens on the
browser process.
BUG=359406
Review URL: https://codereview.chromium.org/1693703003
Cr-Commit-Position: refs/heads/master@{#375223}
Diffstat (limited to 'base')
-rw-r--r-- | base/metrics/field_trial.cc | 15 | ||||
-rw-r--r-- | base/metrics/field_trial.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc index 866c53a..647fe55 100644 --- a/base/metrics/field_trial.cc +++ b/base/metrics/field_trial.cc @@ -105,6 +105,16 @@ bool ParseFieldTrialsString(const std::string& trials_string, return true; } +void CheckTrialGroup(const std::string& trial_name, + const std::string& trial_group, + std::map<std::string, std::string>* seen_states) { + if (ContainsKey(*seen_states, trial_name)) { + CHECK_EQ((*seen_states)[trial_name], trial_group) << trial_name; + } else { + (*seen_states)[trial_name] = trial_group; + } +} + } // namespace // statics @@ -475,6 +485,9 @@ void FieldTrialList::AllStatesToString(std::string* output) { output->append(1, kPersistentStringSeparator); trial.group_name.AppendToString(output); output->append(1, kPersistentStringSeparator); + + CheckTrialGroup(trial.trial_name.as_string(), trial.group_name.as_string(), + &global_->seen_states_); } } @@ -600,6 +613,8 @@ void FieldTrialList::NotifyFieldTrialGroupSelection(FieldTrial* field_trial) { if (!field_trial->enable_field_trial_) return; + CheckTrialGroup(field_trial->trial_name(), field_trial->group_name_internal(), + &global_->seen_states_); global_->observer_list_->Notify( FROM_HERE, &FieldTrialList::Observer::OnFieldTrialGroupFinalized, field_trial->trial_name(), field_trial->group_name_internal()); diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h index 7bfc1de..0dfa036 100644 --- a/base/metrics/field_trial.h +++ b/base/metrics/field_trial.h @@ -519,6 +519,8 @@ class BASE_EXPORT FieldTrialList { base::Lock lock_; RegistrationMap registered_; + std::map<std::string, std::string> seen_states_; + // Entropy provider to be used for one-time randomized field trials. If NULL, // one-time randomization is not supported. scoped_ptr<const FieldTrial::EntropyProvider> entropy_provider_; |