Bug 1377324 - Don't compute prepared data multiple times for ContainerLayers that are duplicated. r=miko

This commit is contained in:
Matt Woodrow 2017-07-07 14:14:19 +12:00
Родитель 4fd709b953
Коммит 94247181df
2 изменённых файлов: 22 добавлений и 0 удалений

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

@ -185,6 +185,12 @@ ContainerPrepare(ContainerT* aContainer,
LayerManagerComposite* aManager,
const RenderTargetIntRect& aClipRect)
{
// We can end up calling prepare multiple times if we duplicated
// layers due to preserve-3d plane splitting. The results
// should be identical, so we only need to do it once.
if (aContainer->mPrepared) {
return;
}
aContainer->mPrepared = MakeUnique<PreparedData>();
aContainer->mPrepared->mNeedsSurfaceCopy = false;
@ -687,6 +693,10 @@ void
ContainerLayerComposite::Cleanup()
{
mPrepared = nullptr;
for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
static_cast<LayerComposite*>(l->AsHostLayer())->Cleanup();
}
}
void
@ -754,6 +764,16 @@ RefLayerComposite::Prepare(const RenderTargetIntRect& aClipRect)
ContainerPrepare(this, mCompositeManager, aClipRect);
}
void
RefLayerComposite::Cleanup()
{
mPrepared = nullptr;
for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
static_cast<LayerComposite*>(l->AsHostLayer())->Cleanup();
}
}
void
RefLayerComposite::CleanupResources()
{

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

@ -183,6 +183,8 @@ public:
DefaultComputeEffectiveTransforms(aTransformToSurface);
}
virtual void Cleanup() override;
virtual void CleanupResources() override;
virtual HostLayer* AsHostLayer() override { return this; }