mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1041690. Make ShmemTextureHost's mShmem member a UniquePtr. r=nical
This makes the ownership clear and removes some code. --HG-- extra : rebase_source : fca529c3e5dd224be090876a6f4528ed8686e4e5
This commit is contained in:
parent
44d166c165
commit
b804c80eae
@ -578,7 +578,7 @@ ShmemTextureHost::ShmemTextureHost(const ipc::Shmem& aShmem,
|
||||
ISurfaceAllocator* aDeallocator,
|
||||
TextureFlags aFlags)
|
||||
: BufferTextureHost(aFormat, aFlags)
|
||||
, mShmem(new ipc::Shmem(aShmem))
|
||||
, mShmem(MakeUnique<ipc::Shmem>(aShmem))
|
||||
, mDeallocator(aDeallocator)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ShmemTextureHost);
|
||||
@ -587,7 +587,7 @@ ShmemTextureHost::ShmemTextureHost(const ipc::Shmem& aShmem,
|
||||
ShmemTextureHost::~ShmemTextureHost()
|
||||
{
|
||||
DeallocateDeviceData();
|
||||
delete mShmem;
|
||||
mShmem = nullptr;
|
||||
MOZ_COUNT_DTOR(ShmemTextureHost);
|
||||
}
|
||||
|
||||
@ -598,7 +598,6 @@ ShmemTextureHost::DeallocateSharedData()
|
||||
MOZ_ASSERT(mDeallocator,
|
||||
"Shared memory would leak without a ISurfaceAllocator");
|
||||
mDeallocator->DeallocShmem(*mShmem);
|
||||
delete mShmem;
|
||||
mShmem = nullptr;
|
||||
}
|
||||
}
|
||||
@ -607,7 +606,6 @@ void
|
||||
ShmemTextureHost::ForgetSharedData()
|
||||
{
|
||||
if (mShmem) {
|
||||
delete mShmem;
|
||||
mShmem = nullptr;
|
||||
}
|
||||
}
|
||||
@ -615,7 +613,6 @@ ShmemTextureHost::ForgetSharedData()
|
||||
void
|
||||
ShmemTextureHost::OnShutdown()
|
||||
{
|
||||
delete mShmem;
|
||||
mShmem = nullptr;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "mozilla/layers/FenceUtils.h" // for FenceHandle
|
||||
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
|
||||
#include "mozilla/mozalloc.h" // for operator delete
|
||||
#include "mozilla/UniquePtr.h" // for UniquePtr
|
||||
#include "nsCOMPtr.h" // for already_AddRefed
|
||||
#include "nsDebug.h" // for NS_RUNTIMEABORT
|
||||
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
||||
@ -569,7 +570,7 @@ public:
|
||||
virtual void OnShutdown() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
mozilla::ipc::Shmem* mShmem;
|
||||
UniquePtr<mozilla::ipc::Shmem> mShmem;
|
||||
RefPtr<ISurfaceAllocator> mDeallocator;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user