Bug 1355787 - nsIdentifierMapEntry should let one to use either strings or atoms as keys to avoid slow string assignments when possible.

Tag #1375
This commit is contained in:
Matt A. Tobin 2020-06-13 08:18:46 -04:00 committed by Roy Tam
commit 15f6d2efda
4 changed files with 76 additions and 22 deletions

View file

@ -319,8 +319,7 @@ ShadowRoot::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
void
ShadowRoot::AddToIdTable(Element* aElement, nsIAtom* aId)
{
nsIdentifierMapEntry *entry =
mIdentifierMap.PutEntry(nsDependentAtomString(aId));
nsIdentifierMapEntry* entry = mIdentifierMap.PutEntry(aId);
if (entry) {
entry->AddIdElement(aElement);
}
@ -329,8 +328,7 @@ ShadowRoot::AddToIdTable(Element* aElement, nsIAtom* aId)
void
ShadowRoot::RemoveFromIdTable(Element* aElement, nsIAtom* aId)
{
nsIdentifierMapEntry *entry =
mIdentifierMap.GetEntry(nsDependentAtomString(aId));
nsIdentifierMapEntry* entry = mIdentifierMap.GetEntry(aId);
if (entry) {
entry->RemoveIdElement(aElement);
if (entry->IsEmpty()) {