mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 18:55:30 +00:00
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:
parent
2615f0ab34
commit
a46e2d8e44
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user