mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 527871: fix shutdown assertion and leaking TestShellParent. still leaking ContentProcessParent's GeckoChildProcess, but needs discussion before fixing
This commit is contained in:
parent
5629855e23
commit
0807e5c7e2
@ -95,6 +95,12 @@ ContentProcessParent::CreateTestShell()
|
||||
return static_cast<TestShellParent*>(SendPTestShellConstructor());
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessParent::DestroyTestShell(TestShellParent* aTestShell)
|
||||
{
|
||||
return SendPTestShellDestructor(aTestShell);
|
||||
}
|
||||
|
||||
ContentProcessParent::ContentProcessParent()
|
||||
: mMonitor("ContentProcessParent::mMonitor")
|
||||
{
|
||||
|
@ -63,6 +63,7 @@ class ContentProcessParent : private PContentProcessParent,
|
||||
{
|
||||
private:
|
||||
typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost;
|
||||
typedef mozilla::ipc::TestShellParent TestShellParent;
|
||||
|
||||
public:
|
||||
static ContentProcessParent* GetSingleton();
|
||||
@ -78,7 +79,9 @@ public:
|
||||
virtual void OnWaitableEventSignaled(base::WaitableEvent *event);
|
||||
|
||||
TabParent* CreateTab();
|
||||
mozilla::ipc::TestShellParent* CreateTestShell();
|
||||
|
||||
TestShellParent* CreateTestShell();
|
||||
bool DestroyTestShell(TestShellParent* aTestShell);
|
||||
|
||||
private:
|
||||
static ContentProcessParent* gSingleton;
|
||||
|
@ -106,21 +106,17 @@ AsyncChannel::Open(Transport* aTransport, MessageLoop* aIOLoop)
|
||||
void
|
||||
AsyncChannel::Close()
|
||||
{
|
||||
// XXXcjones pretty much stuck with this bad parent/child
|
||||
// dichotomy as long as the child's IO thread is the "main"
|
||||
// thread and we don't have proper shutdown handling implemented.
|
||||
if (mChild)
|
||||
return OnClose();
|
||||
|
||||
AssertWorkerThread();
|
||||
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
mIOLoop->PostTask(
|
||||
FROM_HERE, NewRunnableMethod(this, &AsyncChannel::OnClose));
|
||||
if (!mChild && ChannelConnected == mChannelState) {
|
||||
AssertWorkerThread();
|
||||
|
||||
while (ChannelConnected == mChannelState)
|
||||
mCvar.Wait();
|
||||
mIOLoop->PostTask(
|
||||
FROM_HERE, NewRunnableMethod(this, &AsyncChannel::OnClose));
|
||||
|
||||
while (ChannelConnected == mChannelState)
|
||||
mCvar.Wait();
|
||||
}
|
||||
|
||||
mTransport = NULL;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
|
||||
virtual ~AsyncChannel()
|
||||
{
|
||||
if (mTransport)
|
||||
if (!mChild && mTransport)
|
||||
Close();
|
||||
// we only hold a weak ref to the transport, which is "owned"
|
||||
// by GeckoChildProcess/GeckoThread
|
||||
|
@ -1947,6 +1947,11 @@ main(int argc, char **argv)
|
||||
JS_DestroyContext(cx);
|
||||
} // this scopes the nsCOMPtrs
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
if (!XRE_ShutdownTestShell())
|
||||
NS_ERROR("problem shutting down testshell");
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
// Get the crashreporter service while XPCOM is still active.
|
||||
// This is a special exception: it will remain usable after NS_ShutdownXPCOM().
|
||||
|
@ -500,6 +500,14 @@ XRE_SendTestShellCommand(JSContext* aCx,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
XRE_ShutdownTestShell()
|
||||
{
|
||||
if (!gTestShellParent)
|
||||
return true;
|
||||
return ContentProcessParent::GetSingleton()->DestroyTestShell(gTestShellParent);
|
||||
}
|
||||
|
||||
#endif // MOZ_IPC
|
||||
|
||||
|
||||
|
@ -490,5 +490,7 @@ XRE_API(bool,
|
||||
XRE_SendTestShellCommand, (JSContext* aCx,
|
||||
JSString* aCommand,
|
||||
void* aCallback))
|
||||
XRE_API(bool,
|
||||
XRE_ShutdownTestShell, ())
|
||||
|
||||
#endif // _nsXULAppAPI_h__
|
||||
|
Loading…
Reference in New Issue
Block a user