Bug 1377993 - Make node slots less memory hungry in common cases.

Tag UXP Issue #1344
This commit is contained in:
Gaming4JC 2020-01-04 19:48:30 -05:00 committed by Roy Tam
commit dd7fa403a8
9 changed files with 203 additions and 178 deletions

View file

@ -1595,7 +1595,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
#endif
{
if (aBindingParent) {
nsDOMSlots *slots = DOMSlots();
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
slots->mBindingParent = aBindingParent; // Weak, so no addref happens.
}
@ -1618,7 +1618,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
}
ShadowRoot* parentContainingShadow = aParent->GetContainingShadow();
if (parentContainingShadow) {
DOMSlots()->mContainingShadow = parentContainingShadow;
ExtendedDOMSlots()->mContainingShadow = parentContainingShadow;
}
}
@ -2007,7 +2007,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
}
#endif
nsDOMSlots* slots = GetExistingDOMSlots();
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
if (clearBindingParent) {
slots->mBindingParent = nullptr;
@ -2055,7 +2055,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
nsICSSDeclaration*
Element::GetSMILOverrideStyle()
{
Element::nsDOMSlots *slots = DOMSlots();
Element::nsExtendedDOMSlots* slots = ExtendedDOMSlots();
if (!slots->mSMILOverrideStyle) {
slots->mSMILOverrideStyle = new nsDOMCSSAttributeDeclaration(this, true);
@ -2067,7 +2067,7 @@ Element::GetSMILOverrideStyle()
DeclarationBlock*
Element::GetSMILOverrideStyleDeclaration()
{
Element::nsDOMSlots *slots = GetExistingDOMSlots();
Element::nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
return slots ? slots->mSMILOverrideStyleDeclaration.get() : nullptr;
}
@ -2075,7 +2075,7 @@ nsresult
Element::SetSMILOverrideStyleDeclaration(DeclarationBlock* aDeclaration,
bool aNotify)
{
Element::nsDOMSlots *slots = DOMSlots();
Element::nsExtendedDOMSlots* slots = ExtendedDOMSlots();
slots->mSMILOverrideStyleDeclaration = aDeclaration;
@ -3988,7 +3988,7 @@ Element::ClearDataset()
nsDataHashtable<nsRefPtrHashKey<DOMIntersectionObserver>, int32_t>*
Element::RegisteredIntersectionObservers()
{
nsDOMSlots* slots = DOMSlots();
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
return &slots->mRegisteredIntersectionObservers;
}
@ -4041,7 +4041,7 @@ Element::UpdateIntersectionObservation(DOMIntersectionObserver* aObserver, int32
void
Element::SetCustomElementData(CustomElementData* aData)
{
nsDOMSlots *slots = DOMSlots();
nsExtendedDOMSlots *slots = ExtendedDOMSlots();
MOZ_ASSERT(!slots->mCustomElementData, "Custom element data may not be changed once set.");
slots->mCustomElementData = aData;
}