mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 774388 - Patch 11: Use a plain RunnableFunction to release the ImageBridgeParent singleton - r=mattwoodrow
This commit is contained in:
parent
69cbbb2503
commit
1867da80fd
@ -44,6 +44,8 @@ using namespace mozilla::gfx;
|
|||||||
|
|
||||||
std::map<base::ProcessId, ImageBridgeParent*> ImageBridgeParent::sImageBridges;
|
std::map<base::ProcessId, ImageBridgeParent*> ImageBridgeParent::sImageBridges;
|
||||||
|
|
||||||
|
MessageLoop* ImageBridgeParent::sMainLoop = nullptr;
|
||||||
|
|
||||||
ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop,
|
ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop,
|
||||||
Transport* aTransport,
|
Transport* aTransport,
|
||||||
ProcessId aChildProcessId)
|
ProcessId aChildProcessId)
|
||||||
@ -57,6 +59,7 @@ ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop,
|
|||||||
// with several bridges
|
// with several bridges
|
||||||
CompositableMap::Create();
|
CompositableMap::Create();
|
||||||
sImageBridges[aChildProcessId] = this;
|
sImageBridges[aChildProcessId] = this;
|
||||||
|
sMainLoop = MessageLoop::current();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageBridgeParent::~ImageBridgeParent()
|
ImageBridgeParent::~ImageBridgeParent()
|
||||||
@ -271,32 +274,21 @@ MessageLoop * ImageBridgeParent::GetMessageLoop() const {
|
|||||||
return mMessageLoop;
|
return mMessageLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReleaseRunnable : public nsRunnable
|
static void
|
||||||
{
|
DeferredReleaseImageBridgeParentOnMainThread(ImageBridgeParent* aDyingImageBridgeParent)
|
||||||
public:
|
|
||||||
ReleaseRunnable(ImageBridgeParent* aRef)
|
|
||||||
: mRef(aRef)
|
|
||||||
{
|
{
|
||||||
|
aDyingImageBridgeParent->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHOD Run()
|
|
||||||
{
|
|
||||||
mRef->Release();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
ImageBridgeParent* mRef;
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ImageBridgeParent::DeferredDestroy()
|
ImageBridgeParent::DeferredDestroy()
|
||||||
{
|
{
|
||||||
ImageBridgeParent* self;
|
ImageBridgeParent* self;
|
||||||
mSelfRef.forget(&self);
|
mSelfRef.forget(&self);
|
||||||
|
|
||||||
nsCOMPtr<nsIRunnable> runnable = new ReleaseRunnable(self);
|
sMainLoop->PostTask(
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
|
FROM_HERE,
|
||||||
|
NewRunnableFunction(&DeferredReleaseImageBridgeParentOnMainThread, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageBridgeParent*
|
ImageBridgeParent*
|
||||||
|
@ -151,6 +151,8 @@ private:
|
|||||||
* Map of all living ImageBridgeParent instances
|
* Map of all living ImageBridgeParent instances
|
||||||
*/
|
*/
|
||||||
static std::map<base::ProcessId, ImageBridgeParent*> sImageBridges;
|
static std::map<base::ProcessId, ImageBridgeParent*> sImageBridges;
|
||||||
|
|
||||||
|
static MessageLoop* sMainLoop;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // layers
|
} // layers
|
||||||
|
Loading…
Reference in New Issue
Block a user