Bug 976766 - Clear layer's buffers when ClearCachedResources() r=nical

This commit is contained in:
Sotaro Ikeda 2014-02-26 13:41:17 -08:00
parent 27b7fe9eb2
commit 11b8051865
3 changed files with 32 additions and 1 deletions

View File

@ -57,6 +57,8 @@ public:
virtual ~CanvasClient() {} virtual ~CanvasClient() {}
virtual void Clear() {};
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) = 0; virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) = 0;
virtual void Updated() { } virtual void Updated() { }
@ -80,6 +82,11 @@ public:
return TextureInfo(COMPOSITABLE_IMAGE); return TextureInfo(COMPOSITABLE_IMAGE);
} }
virtual void Clear() MOZ_OVERRIDE
{
mBuffer = nullptr;
}
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) MOZ_OVERRIDE; virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) MOZ_OVERRIDE;
virtual bool AddTextureClient(TextureClient* aTexture) MOZ_OVERRIDE virtual bool AddTextureClient(TextureClient* aTexture) MOZ_OVERRIDE
@ -113,6 +120,11 @@ public:
return TextureInfo(COMPOSITABLE_IMAGE); return TextureInfo(COMPOSITABLE_IMAGE);
} }
virtual void Clear() MOZ_OVERRIDE
{
mBuffer = nullptr;
}
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) MOZ_OVERRIDE; virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) MOZ_OVERRIDE;
virtual void OnDetach() MOZ_OVERRIDE virtual void OnDetach() MOZ_OVERRIDE

View File

@ -56,6 +56,13 @@ public:
virtual void RenderLayer(); virtual void RenderLayer();
virtual void ClearCachedResources()
{
if (mCanvasClient) {
mCanvasClient->Clear();
}
}
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
{ {
aAttrs = CanvasLayerAttributes(mFilter, mBounds); aAttrs = CanvasLayerAttributes(mFilter, mBounds);

View File

@ -206,7 +206,12 @@ public:
typedef RotatedContentBuffer::PaintState PaintState; typedef RotatedContentBuffer::PaintState PaintState;
typedef RotatedContentBuffer::ContentType ContentType; typedef RotatedContentBuffer::ContentType ContentType;
virtual void Clear() { RotatedContentBuffer::Clear(); } virtual void Clear()
{
RotatedContentBuffer::Clear();
mTextureClient = nullptr;
mTextureClientOnWhite = nullptr;
}
virtual PaintState BeginPaintBuffer(ThebesLayer* aLayer, virtual PaintState BeginPaintBuffer(ThebesLayer* aLayer,
uint32_t aFlags) MOZ_OVERRIDE uint32_t aFlags) MOZ_OVERRIDE
@ -424,6 +429,13 @@ public:
} }
virtual ~ContentClientDoubleBuffered() {} virtual ~ContentClientDoubleBuffered() {}
virtual void Clear() MOZ_OVERRIDE
{
ContentClientRemoteBuffer::Clear();
mFrontClient = nullptr;
mFrontClientOnWhite = nullptr;
}
virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) MOZ_OVERRIDE; virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) MOZ_OVERRIDE;
virtual void PrepareFrame() MOZ_OVERRIDE; virtual void PrepareFrame() MOZ_OVERRIDE;