Bug 1240921 - Use nsAutoTArray in nsStyleSet::RuleNodeWithReplacement. r=bz.

It's hot in some workloads and so this avoids some heap churn.
This commit is contained in:
Nicholas Nethercote 2016-01-20 15:01:25 -08:00
parent d3433dfe83
commit 466173ba37

View File

@ -1521,7 +1521,9 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
// rule tree from ElementRestyler::RestyleSelf to avoid taking that
// path when we're rebuilding the rule tree.
nsTArray<RuleNodeInfo> rules;
// This array can be hot and often grows to ~20 elements, so inline storage
// is best.
nsAutoTArray<RuleNodeInfo, 30> rules;
for (nsRuleNode* ruleNode = aOldRuleNode; !ruleNode->IsRoot();
ruleNode = ruleNode->GetParent()) {
RuleNodeInfo* curRule = rules.AppendElement();