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
a324886884
commit
c8f077d791
@ -44,6 +44,8 @@ using namespace mozilla::gfx;
|
||||
|
||||
std::map<base::ProcessId, ImageBridgeParent*> ImageBridgeParent::sImageBridges;
|
||||
|
||||
MessageLoop* ImageBridgeParent::sMainLoop = nullptr;
|
||||
|
||||
ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop,
|
||||
Transport* aTransport,
|
||||
ProcessId aChildProcessId)
|
||||
@ -57,6 +59,7 @@ ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop,
|
||||
// with several bridges
|
||||
CompositableMap::Create();
|
||||
sImageBridges[aChildProcessId] = this;
|
||||
sMainLoop = MessageLoop::current();
|
||||
}
|
||||
|
||||
ImageBridgeParent::~ImageBridgeParent()
|
||||
@ -271,23 +274,11 @@ MessageLoop * ImageBridgeParent::GetMessageLoop() const {
|
||||
return mMessageLoop;
|
||||
}
|
||||
|
||||
class ReleaseRunnable : public nsRunnable
|
||||
static void
|
||||
DeferredReleaseImageBridgeParentOnMainThread(ImageBridgeParent* aDyingImageBridgeParent)
|
||||
{
|
||||
public:
|
||||
ReleaseRunnable(ImageBridgeParent* aRef)
|
||||
: mRef(aRef)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mRef->Release();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
ImageBridgeParent* mRef;
|
||||
};
|
||||
aDyingImageBridgeParent->Release();
|
||||
}
|
||||
|
||||
void
|
||||
ImageBridgeParent::DeferredDestroy()
|
||||
@ -295,8 +286,9 @@ ImageBridgeParent::DeferredDestroy()
|
||||
ImageBridgeParent* self;
|
||||
mSelfRef.forget(&self);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable = new ReleaseRunnable(self);
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
|
||||
sMainLoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(&DeferredReleaseImageBridgeParentOnMainThread, this));
|
||||
}
|
||||
|
||||
ImageBridgeParent*
|
||||
|
@ -151,6 +151,8 @@ private:
|
||||
* Map of all living ImageBridgeParent instances
|
||||
*/
|
||||
static std::map<base::ProcessId, ImageBridgeParent*> sImageBridges;
|
||||
|
||||
static MessageLoop* sMainLoop;
|
||||
};
|
||||
|
||||
} // layers
|
||||
|
Loading…
Reference in New Issue
Block a user