зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1128170 - Use UniquePtr for TextureClient KeepAlive objects to make sure we don't leak them. r=jrmuizel
This commit is contained in:
Родитель
5cc04bad46
Коммит
5ea802bd9a
|
@ -86,7 +86,6 @@ public:
|
|||
TextureChild()
|
||||
: mForwarder(nullptr)
|
||||
, mTextureClient(nullptr)
|
||||
, mKeep(nullptr)
|
||||
, mIPCOpen(false)
|
||||
{
|
||||
}
|
||||
|
@ -135,7 +134,7 @@ private:
|
|||
RefPtr<CompositableForwarder> mForwarder;
|
||||
RefPtr<TextureClient> mWaitForRecycle;
|
||||
TextureClient* mTextureClient;
|
||||
KeepAlive* mKeep;
|
||||
UniquePtr<KeepAlive> mKeep;
|
||||
bool mIPCOpen;
|
||||
|
||||
friend class TextureClient;
|
||||
|
@ -154,7 +153,7 @@ TextureChild::ActorDestroy(ActorDestroyReason why)
|
|||
mTextureClient->mActor = nullptr;
|
||||
}
|
||||
mWaitForRecycle = nullptr;
|
||||
delete mKeep;
|
||||
mKeep = nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -496,11 +495,11 @@ TextureClient::~TextureClient()
|
|||
}
|
||||
|
||||
void
|
||||
TextureClient::KeepUntilFullDeallocation(KeepAlive* aKeep)
|
||||
TextureClient::KeepUntilFullDeallocation(UniquePtr<KeepAlive> aKeep)
|
||||
{
|
||||
MOZ_ASSERT(mActor);
|
||||
MOZ_ASSERT(!mActor->mKeep);
|
||||
mActor->mKeep = aKeep;
|
||||
mActor->mKeep = Move(aKeep);
|
||||
}
|
||||
|
||||
void TextureClient::ForceRemove(bool sync)
|
||||
|
|
|
@ -403,7 +403,7 @@ public:
|
|||
* It's a temporary hack to ensure that DXGI textures don't get destroyed
|
||||
* between serialization and deserialization.
|
||||
*/
|
||||
void KeepUntilFullDeallocation(KeepAlive* aKeep);
|
||||
void KeepUntilFullDeallocation(UniquePtr<KeepAlive> aKeep);
|
||||
|
||||
/**
|
||||
* Create and init the TextureChild/Parent IPDL actor pair.
|
||||
|
|
|
@ -179,9 +179,9 @@ TextureClientD3D11::~TextureClientD3D11()
|
|||
{
|
||||
if (mActor) {
|
||||
if (mTexture) {
|
||||
KeepUntilFullDeallocation(new TKeepAlive<ID3D10Texture2D>(mTexture10));
|
||||
KeepUntilFullDeallocation(MakeUnique<TKeepAlive<ID3D10Texture2D>>(mTexture10));
|
||||
} else if (mTexture10) {
|
||||
KeepUntilFullDeallocation(new TKeepAlive<ID3D11Texture2D>(mTexture));
|
||||
KeepUntilFullDeallocation(MakeUnique<TKeepAlive<ID3D11Texture2D>>(mTexture));
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -739,7 +739,7 @@ SharedTextureClientD3D9::SharedTextureClientD3D9(ISurfaceAllocator* aAllocator,
|
|||
SharedTextureClientD3D9::~SharedTextureClientD3D9()
|
||||
{
|
||||
if (mTexture && mActor) {
|
||||
KeepUntilFullDeallocation(new TKeepAlive<IDirect3DTexture9>(mTexture));
|
||||
KeepUntilFullDeallocation(MakeUnique<TKeepAlive<IDirect3DTexture9>>(mTexture));
|
||||
}
|
||||
if (mTexture) {
|
||||
gfxWindowsPlatform::sD3D9SharedTextureUsed -= mDesc.Width * mDesc.Height * 4;
|
||||
|
|
|
@ -266,8 +266,10 @@ public:
|
|||
mTexture = aTexture;
|
||||
mHandle = aSharedHandle;
|
||||
mDesc = aDesc;
|
||||
if (mTexture) {
|
||||
gfxWindowsPlatform::sD3D9SharedTextureUsed += mDesc.Width * mDesc.Height * 4;
|
||||
}
|
||||
}
|
||||
|
||||
virtual gfx::IntSize GetSize() const
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче