mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1219529 - Don't attempt to deallocate shmems after the ipdl protocol is shut down. r=sotaro
This commit is contained in:
parent
df8330fb2f
commit
e6f04f4af3
@ -58,6 +58,7 @@ ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop,
|
||||
: mMessageLoop(aLoop)
|
||||
, mTransport(aTransport)
|
||||
, mSetChildThreadPriority(false)
|
||||
, mStopped(false)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
sMainLoop = MessageLoop::current();
|
||||
@ -206,9 +207,12 @@ ReleaseImageBridgeParent(ImageBridgeParent* aImageBridgeParent)
|
||||
|
||||
bool ImageBridgeParent::RecvStop()
|
||||
{
|
||||
// This message just serves as synchronization between the
|
||||
// This message mostly serves as synchronization between the
|
||||
// child and parent threads during shutdown.
|
||||
|
||||
// Can't alloc/dealloc shmems from now on.
|
||||
mStopped = true;
|
||||
|
||||
// There is one thing that we need to do here: temporarily addref, so that
|
||||
// the handling of this sync message can't race with the destruction of
|
||||
// the ImageBridgeParent, which would trigger the dreaded "mismatched CxxStackFrames"
|
||||
@ -383,6 +387,38 @@ ImageBridgeParent::OnChannelConnected(int32_t aPid)
|
||||
mCompositorThreadHolder = GetCompositorThreadHolder();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ImageBridgeParent::AllocShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem)
|
||||
{
|
||||
if (mStopped) {
|
||||
return false;
|
||||
}
|
||||
return PImageBridgeParent::AllocShmem(aSize, aType, aShmem);
|
||||
}
|
||||
|
||||
bool
|
||||
ImageBridgeParent::AllocUnsafeShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem)
|
||||
{
|
||||
if (mStopped) {
|
||||
return false;
|
||||
}
|
||||
return PImageBridgeParent::AllocUnsafeShmem(aSize, aType, aShmem);
|
||||
}
|
||||
|
||||
void
|
||||
ImageBridgeParent::DeallocShmem(ipc::Shmem& aShmem)
|
||||
{
|
||||
if (mStopped) {
|
||||
return;
|
||||
}
|
||||
PImageBridgeParent::DeallocShmem(aShmem);
|
||||
}
|
||||
|
||||
bool ImageBridgeParent::IsSameProcess() const
|
||||
{
|
||||
return OtherPid() == base::GetCurrentProcId();
|
||||
|
@ -100,24 +100,15 @@ public:
|
||||
|
||||
// ISurfaceAllocator
|
||||
|
||||
bool AllocShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem) override
|
||||
{
|
||||
return PImageBridgeParent::AllocShmem(aSize, aType, aShmem);
|
||||
}
|
||||
virtual bool AllocShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem) override;
|
||||
|
||||
bool AllocUnsafeShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem) override
|
||||
{
|
||||
return PImageBridgeParent::AllocUnsafeShmem(aSize, aType, aShmem);
|
||||
}
|
||||
virtual bool AllocUnsafeShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem) override;
|
||||
|
||||
void DeallocShmem(ipc::Shmem& aShmem) override
|
||||
{
|
||||
PImageBridgeParent::DeallocShmem(aShmem);
|
||||
}
|
||||
virtual void DeallocShmem(ipc::Shmem& aShmem) override;
|
||||
|
||||
virtual bool IsSameProcess() const override;
|
||||
|
||||
@ -162,6 +153,7 @@ private:
|
||||
RefPtr<ImageBridgeParent> mSelfRef;
|
||||
|
||||
bool mSetChildThreadPriority;
|
||||
bool mStopped;
|
||||
|
||||
/**
|
||||
* Map of all living ImageBridgeParent instances
|
||||
|
@ -174,13 +174,19 @@ LayerTransactionParent::RecvShutdown()
|
||||
void
|
||||
LayerTransactionParent::Destroy()
|
||||
{
|
||||
mDestroyed = true;
|
||||
const ManagedContainer<PLayerParent>& layers = ManagedPLayerParent();
|
||||
for (auto iter = layers.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
ShadowLayerParent* slp =
|
||||
static_cast<ShadowLayerParent*>(iter.Get()->GetKey());
|
||||
slp->Destroy();
|
||||
}
|
||||
InfallibleTArray<PTextureParent*> textures;
|
||||
ManagedPTextureParent(textures);
|
||||
for (unsigned int i = 0; i < textures.Length(); ++i) {
|
||||
RefPtr<TextureHost> tex = TextureHost::AsTextureHost(textures[i]);
|
||||
tex->DeallocateDeviceData();
|
||||
}
|
||||
mDestroyed = true;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -989,6 +995,38 @@ LayerTransactionParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
LayerTransactionParent::AllocShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem)
|
||||
{
|
||||
if (!mIPCOpen || mDestroyed) {
|
||||
return false;
|
||||
}
|
||||
return PLayerTransactionParent::AllocShmem(aSize, aType, aShmem);
|
||||
}
|
||||
|
||||
bool
|
||||
LayerTransactionParent::AllocUnsafeShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem)
|
||||
{
|
||||
if (!mIPCOpen || mDestroyed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return PLayerTransactionParent::AllocUnsafeShmem(aSize, aType, aShmem);
|
||||
}
|
||||
|
||||
void
|
||||
LayerTransactionParent::DeallocShmem(ipc::Shmem& aShmem)
|
||||
{
|
||||
if (!mIPCOpen || mDestroyed) {
|
||||
return;
|
||||
}
|
||||
PLayerTransactionParent::DeallocShmem(aShmem);
|
||||
}
|
||||
|
||||
bool LayerTransactionParent::IsSameProcess() const
|
||||
{
|
||||
return OtherPid() == base::GetCurrentProcId();
|
||||
|
@ -63,20 +63,13 @@ public:
|
||||
// ISurfaceAllocator
|
||||
virtual bool AllocShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem) override {
|
||||
return PLayerTransactionParent::AllocShmem(aSize, aType, aShmem);
|
||||
}
|
||||
ipc::Shmem* aShmem) override;
|
||||
|
||||
virtual bool AllocUnsafeShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem) override {
|
||||
return PLayerTransactionParent::AllocUnsafeShmem(aSize, aType, aShmem);
|
||||
}
|
||||
ipc::Shmem* aShmem) override;
|
||||
|
||||
virtual void DeallocShmem(ipc::Shmem& aShmem) override
|
||||
{
|
||||
PLayerTransactionParent::DeallocShmem(aShmem);
|
||||
}
|
||||
virtual void DeallocShmem(ipc::Shmem& aShmem) override;
|
||||
|
||||
virtual bool IsSameProcess() const override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user