Bug 1399787 - Part 8. Open PDFium protocol channel. r=jwatt

MozReview-Commit-ID: F9W9ykEtVmK

--HG--
extra : rebase_source : 41936e4b7ffdb5ec00a005d4aeaa2754fe2f6daa
extra : intermediate-source : f9ef88f9ddc9ddb114633075472f5a20985d8c39
extra : source : 63e98299090e4fb98c2fb50aa9eaac35f35ca232
This commit is contained in:
cku 2017-10-17 12:48:30 +08:00
parent 2615f0ab34
commit a46e2d8e44
2 changed files with 43 additions and 1 deletions

View File

@ -26,17 +26,47 @@ PDFiumProcessParent::PDFiumProcessParent()
PDFiumProcessParent::~PDFiumProcessParent()
{
MOZ_COUNT_DTOR(PDFiumProcessParent);
if (mPDFiumParentActor) {
mPDFiumParentActor->Close();
}
}
bool
PDFiumProcessParent::Launch()
{
return SyncLaunch();
mLaunchThread = NS_GetCurrentThread();
if (!SyncLaunch()) {
return false;
}
// Open the top level protocol for PDFium process.
MOZ_ASSERT(!mPDFiumParentActor);
mPDFiumParentActor = new PDFiumParent();
return mPDFiumParentActor->Init(GetChannel(),
base::GetProcId(GetChildProcessHandle()));
}
void
PDFiumProcessParent::Delete()
{
// PDFiumProcessParent::Launch is not called, protocol is not created.
// It is safe to destroy this object on any thread.
if (!mLaunchThread) {
delete this;
return;
}
if (mLaunchThread == NS_GetCurrentThread()) {
delete this;
return;
}
mLaunchThread->Dispatch(
NewNonOwningRunnableMethod("PDFiumProcessParent::Delete",
this,
&PDFiumProcessParent::Delete));
}
} // namespace widget

View File

@ -11,6 +11,15 @@
#include "mozilla/ipc/GeckoChildProcessHost.h"
class nsIRunnable;
class nsDeviceContextSpecWin;
#ifdef MOZ_ENABLE_SKIA_PDF
namespace mozilla {
namespace widget {
class PDFiumParent;
}
}
#endif
namespace mozilla {
namespace widget {
@ -30,6 +39,9 @@ public:
private:
DISALLOW_COPY_AND_ASSIGN(PDFiumProcessParent);
RefPtr<PDFiumParent> mPDFiumParentActor;
nsCOMPtr<nsIThread> mLaunchThread;
};
} // namespace widget