mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1372327 - Use LookupForAdd instead of Get+Put to avoid unnecessary hashtable lookups. r=froydnj
MozReview-Commit-ID: 5J6Ea73JX4f
This commit is contained in:
parent
2979d4b762
commit
185a60c094
@ -380,12 +380,13 @@ EventListenerService::NotifyAboutMainThreadListenerChangeInternal(dom::EventTarg
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<EventListenerChange> changes = mPendingListenerChangesSet.Get(aTarget);
|
||||
if (!changes) {
|
||||
changes = new EventListenerChange(aTarget);
|
||||
mPendingListenerChanges->AppendElement(changes, false);
|
||||
mPendingListenerChangesSet.Put(aTarget, changes);
|
||||
}
|
||||
RefPtr<EventListenerChange> changes =
|
||||
mPendingListenerChangesSet.LookupForAdd(aTarget).OrInsert(
|
||||
[this, aTarget] () {
|
||||
EventListenerChange* c = new EventListenerChange(aTarget);
|
||||
mPendingListenerChanges->AppendElement(c, false);
|
||||
return c;
|
||||
});
|
||||
changes->AddChangedListenerName(aName);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user