mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1225873 - micro-optimize creating event target chains; r=smaug
This code is only called in a few cases that aren't on the critical path, but less code is less code: we eliminate the checks for whether we have enough space in the copying loop, and maybe save some function calls.
This commit is contained in:
parent
aebdc6cc4f
commit
5aa6eb62b0
@ -642,9 +642,10 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (aTargets) {
|
||||
aTargets->Clear();
|
||||
aTargets->SetCapacity(chain.Length());
|
||||
for (uint32_t i = 0; i < chain.Length(); ++i) {
|
||||
aTargets->AppendElement(chain[i].CurrentTarget()->GetTargetForDOMEvent());
|
||||
uint32_t numTargets = chain.Length();
|
||||
EventTarget** targets = aTargets->AppendElements(numTargets);
|
||||
for (uint32_t i = 0; i < numTargets; ++i) {
|
||||
targets[i] = chain[i].CurrentTarget()->GetTargetForDOMEvent();
|
||||
}
|
||||
} else {
|
||||
// Event target chain is created. Handle the chain.
|
||||
|
Loading…
Reference in New Issue
Block a user