forked from mirrors/gecko-dev
Bug 1478138 - micro-optimize frame property lookup; r=dholbert
Once we've determined an index for the frame property, we don't need to pay the overhead of checking whether that index is in bounds for the array again on the next access. It would be nice if we could avoid that overhead for removal, too, but since there's no API for that, we'll just remove the overhead for accesses.
This commit is contained in:
parent
2f8c84f735
commit
0ebdcdbf60
1 changed files with 4 additions and 4 deletions
|
|
@ -421,7 +421,7 @@ FrameProperties::GetInternal(UntypedDescriptor aProperty,
|
|||
if (aFoundResult) {
|
||||
*aFoundResult = true;
|
||||
}
|
||||
return mProperties.ElementAt(index).mValue;
|
||||
return mProperties.Elements()[index].mValue;
|
||||
}
|
||||
|
||||
inline void
|
||||
|
|
@ -433,7 +433,7 @@ FrameProperties::SetInternal(UntypedDescriptor aProperty, void* aValue,
|
|||
|
||||
auto index = mProperties.IndexOf(aProperty, 0, PropertyComparator());
|
||||
if (index != nsTArray<PropertyValue>::NoIndex) {
|
||||
PropertyValue* pv = &mProperties.ElementAt(index);
|
||||
PropertyValue* pv = &mProperties.Elements()[index];
|
||||
pv->DestroyValueFor(aFrame);
|
||||
pv->mValue = aValue;
|
||||
return;
|
||||
|
|
@ -469,7 +469,7 @@ FrameProperties::RemoveInternal(UntypedDescriptor aProperty, bool* aFoundResult)
|
|||
*aFoundResult = true;
|
||||
}
|
||||
|
||||
void* result = mProperties.ElementAt(index).mValue;
|
||||
void* result = mProperties.Elements()[index].mValue;
|
||||
mProperties.RemoveElementAt(index);
|
||||
|
||||
return result;
|
||||
|
|
@ -484,7 +484,7 @@ FrameProperties::DeleteInternal(UntypedDescriptor aProperty,
|
|||
|
||||
auto index = mProperties.IndexOf(aProperty, 0, PropertyComparator());
|
||||
if (index != nsTArray<PropertyValue>::NoIndex) {
|
||||
mProperties.ElementAt(index).DestroyValueFor(aFrame);
|
||||
mProperties.Elements()[index].DestroyValueFor(aFrame);
|
||||
mProperties.RemoveElementAt(index);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue