Bug 1376594 - Track locally whether an effect is part of an EffectSet to avoid hashmap lookups; r=hiro

MozReview-Commit-ID: IEeAmyR9ZlS

--HG--
extra : rebase_source : 112ec688662a14668839f3ceb45192e50edbe381
This commit is contained in:
Brian Birtles 2017-07-05 10:29:58 +09:00
Родитель b3cec144b3
Коммит 8ff7b93580
2 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -957,12 +957,13 @@ KeyframeEffectReadOnly::UpdateTargetRegistration()
MOZ_ASSERT(isRelevant == IsCurrent() || IsInEffect(),
"Out of date Animation::IsRelevant value");
if (isRelevant) {
if (isRelevant && !mInEffectSet) {
EffectSet* effectSet =
EffectSet::GetOrCreateEffectSet(mTarget->mElement, mTarget->mPseudoType);
effectSet->AddEffect(*this);
mInEffectSet = true;
UpdateEffectSet(effectSet);
} else {
} else if (!isRelevant && mInEffectSet) {
UnregisterTarget();
}
}
@ -970,8 +971,15 @@ KeyframeEffectReadOnly::UpdateTargetRegistration()
void
KeyframeEffectReadOnly::UnregisterTarget()
{
if (!mInEffectSet) {
return;
}
EffectSet* effectSet =
EffectSet::GetEffectSet(mTarget->mElement, mTarget->mPseudoType);
MOZ_ASSERT(effectSet, "If mInEffectSet is true, there must be an EffectSet"
" on the target element");
mInEffectSet = false;
if (effectSet) {
effectSet->RemoveEffect(*this);
@ -1834,6 +1842,10 @@ KeyframeEffectReadOnly::ContainsAnimatedScale(const nsIFrame* aFrame) const
void
KeyframeEffectReadOnly::UpdateEffectSet(EffectSet* aEffectSet) const
{
if (!mInEffectSet) {
return;
}
EffectSet* effectSet =
aEffectSet ? aEffectSet
: EffectSet::GetEffectSet(mTarget->mElement,

Просмотреть файл

@ -417,6 +417,11 @@ protected:
nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>
mBaseStyleValuesForServo;
// True if this effect is in the EffectSet for its target element. This is
// used as an optimization to avoid unnecessary hashmap lookups on the
// EffectSet.
bool mInEffectSet = false;
// We only want to record telemetry data for "ContentTooLarge" warnings once
// per effect:target pair so we use this member to record if we have already
// reported a "ContentTooLarge" warning for the current target.