зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1372022
- Replace a series of Contains+Put+Get+Put hashtable lookups with a single LookupForAdd call. r=froydnj
MozReview-Commit-ID: GOSe2Ztahlr
This commit is contained in:
Родитель
2dffd04a1b
Коммит
a821681287
|
@ -1719,12 +1719,15 @@ nsDisplayListBuilder::AddToWillChangeBudget(nsIFrame* aFrame,
|
|||
}
|
||||
|
||||
nsPresContext* key = aFrame->PresContext();
|
||||
if (!mWillChangeBudget.Contains(key)) {
|
||||
mWillChangeBudget.Put(key, DocumentWillChangeBudget());
|
||||
}
|
||||
|
||||
DocumentWillChangeBudget budget;
|
||||
mWillChangeBudget.Get(key, &budget);
|
||||
auto willChangeBudgetEntry = mWillChangeBudget.LookupForAdd(key);
|
||||
if (willChangeBudgetEntry) {
|
||||
// We have an existing entry.
|
||||
budget = willChangeBudgetEntry.Data();
|
||||
} else {
|
||||
budget = DocumentWillChangeBudget();
|
||||
willChangeBudgetEntry.OrInsert([&budget] () { return budget; });
|
||||
}
|
||||
|
||||
nsRect area = aFrame->PresContext()->GetVisibleArea();
|
||||
uint32_t budgetLimit = nsPresContext::AppUnitsToIntCSSPixels(area.width) *
|
||||
|
@ -1736,7 +1739,7 @@ nsDisplayListBuilder::AddToWillChangeBudget(nsIFrame* aFrame,
|
|||
|
||||
if (onBudget) {
|
||||
budget.mBudget += cost;
|
||||
mWillChangeBudget.Put(key, budget);
|
||||
willChangeBudgetEntry.Data() = budget;
|
||||
mWillChangeBudgetSet.PutEntry(aFrame);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче