mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1251615 - Add more safety checks for ComputeChange crash. r=mstange
MozReview-Commit-ID: 2zdycnmRA8u
This commit is contained in:
parent
8e7896a8c6
commit
b1c543d280
@ -171,6 +171,7 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
// Bug 1251615: This canary is sometimes hit. We're still not sure why.
|
||||
mCanary.Check();
|
||||
bool transformChanged = !mTransform.FuzzyEqual(GetTransformForInvalidation(mLayer)) ||
|
||||
mLayer->GetPostXScale() != mPostXScale ||
|
||||
@ -232,6 +233,12 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
return result;
|
||||
}
|
||||
|
||||
void CheckCanary()
|
||||
{
|
||||
mCanary.Check();
|
||||
mLayer->CheckCanary();
|
||||
}
|
||||
|
||||
virtual IntRect NewTransformedBounds()
|
||||
{
|
||||
return TransformRect(mLayer->GetLocalVisibleRegion().ToUnknownRegion().GetBounds(),
|
||||
@ -278,6 +285,8 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
||||
nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged) override
|
||||
{
|
||||
// Make sure we got our virtual call right
|
||||
mSubtypeCanary.Check();
|
||||
ContainerLayer* container = mLayer->AsContainerLayer();
|
||||
nsIntRegion invalidOfLayer; // Invalid regions of this layer.
|
||||
nsIntRegion result; // Invliad regions for children only.
|
||||
@ -307,7 +316,7 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
||||
|
||||
nsDataHashtable<nsPtrHashKey<Layer>, uint32_t> oldIndexMap(mChildren.Length());
|
||||
for (uint32_t i = 0; i < mChildren.Length(); ++i) {
|
||||
mChildren[i]->mLayer->CheckCanary();
|
||||
mChildren[i]->CheckCanary();
|
||||
oldIndexMap.Put(mChildren[i]->mLayer, i);
|
||||
}
|
||||
|
||||
@ -327,6 +336,9 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
||||
AddRegion(result, mChildren[j]->OldTransformedBounds());
|
||||
childrenChanged |= true;
|
||||
}
|
||||
if (childsOldIndex >= mChildren.Length()) {
|
||||
MOZ_CRASH("Out of bounds");
|
||||
}
|
||||
// Invalidate any regions of the child that have changed:
|
||||
nsIntRegion region = mChildren[childsOldIndex]->ComputeChange(aCallback, aGeometryChanged);
|
||||
i = childsOldIndex + 1;
|
||||
@ -413,7 +425,8 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
||||
}
|
||||
|
||||
// The old list of children:
|
||||
AutoTArray<UniquePtr<LayerPropertiesBase>,1> mChildren;
|
||||
mozilla::CorruptionCanary mSubtypeCanary;
|
||||
nsTArray<UniquePtr<LayerPropertiesBase>> mChildren;
|
||||
float mPreXScale;
|
||||
float mPreYScale;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user