Bug 874367 - Release TextureUpdateRequest memory in the destructor to prevent leaks. r=nical

This commit is contained in:
Matt Woodrow 2013-05-22 11:36:38 +08:00
parent 3f8ff3ca06
commit 69ba89c3f3
2 changed files with 13 additions and 6 deletions

View File

@ -450,7 +450,8 @@ ContentHostIncremental::UpdateIncremental(TextureIdentifier aTextureId,
const nsIntRect& aBufferRect,
const nsIntPoint& aBufferRotation)
{
mUpdateList.AppendElement(new TextureUpdateRequest(aTextureId,
mUpdateList.AppendElement(new TextureUpdateRequest(mDeAllocator,
aTextureId,
aSurface,
aUpdated,
aBufferRect,
@ -642,9 +643,6 @@ ContentHostIncremental::TextureUpdateRequest::Execute(ContentHostIncremental* aH
} else {
aHost->mTextureHostOnWhite->Update(mDescriptor, &mUpdated, &offset);
}
//TODO: Recycle these?
aHost->mDeAllocator->DestroySharedSurface(&mDescriptor);
}
#ifdef MOZ_LAYERS_HAVE_LOG

View File

@ -308,18 +308,26 @@ private:
class TextureUpdateRequest : public Request
{
public:
TextureUpdateRequest(TextureIdentifier aTextureId,
TextureUpdateRequest(ISurfaceAllocator* aDeAllocator,
TextureIdentifier aTextureId,
SurfaceDescriptor& aDescriptor,
const nsIntRegion& aUpdated,
const nsIntRect& aBufferRect,
const nsIntPoint& aBufferRotation)
: mTextureId(aTextureId)
: mDeAllocator(aDeAllocator)
, mTextureId(aTextureId)
, mDescriptor(aDescriptor)
, mUpdated(aUpdated)
, mBufferRect(aBufferRect)
, mBufferRotation(aBufferRotation)
{}
~TextureUpdateRequest()
{
//TODO: Recycle these?
mDeAllocator->DestroySharedSurface(&mDescriptor);
}
virtual void Execute(ContentHostIncremental *aHost);
private:
@ -332,6 +340,7 @@ private:
nsIntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const;
ISurfaceAllocator* mDeAllocator;
TextureIdentifier mTextureId;
SurfaceDescriptor mDescriptor;
nsIntRegion mUpdated;