mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1399787 - Part 5. Implement the PDFium process. r=jwatt
MozReview-Commit-ID: 502jB9DAeIC --HG-- extra : rebase_source : f5521bd85370a6726380c36ea90d4c5a4edf403f extra : intermediate-source : 695dfd5232f9e3ca08205fbc99cc5cbbe8737b12 extra : source : 2903a56630965e02602ff4aa3e38c51207b6fa15
This commit is contained in:
parent
764be8763e
commit
f237af17a1
@ -902,9 +902,10 @@ SYNC_ENUMS(CONTENT, Content)
|
||||
SYNC_ENUMS(IPDLUNITTEST, IPDLUnitTest)
|
||||
SYNC_ENUMS(GMPLUGIN, GMPlugin)
|
||||
SYNC_ENUMS(GPU, GPU)
|
||||
SYNC_ENUMS(PDFIUM, PDFium)
|
||||
|
||||
// .. and ensure that that is all of them:
|
||||
static_assert(GeckoProcessType_GPU + 1 == GeckoProcessType_End,
|
||||
static_assert(GeckoProcessType_PDFium + 1 == GeckoProcessType_End,
|
||||
"Did not find the final GeckoProcessType");
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -116,6 +116,10 @@ using mozilla::_ipdltest::IPDLUnitTestProcessChild;
|
||||
#include "jprof.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_ENABLE_SKIA_PDF)
|
||||
#include "mozilla/widget/PDFiumProcessChild.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
using mozilla::ipc::BrowserProcessSubThread;
|
||||
@ -605,6 +609,7 @@ XRE_InitChildProcess(int aArgc,
|
||||
uiLoopType = MessageLoop::TYPE_MOZILLA_CHILD;
|
||||
break;
|
||||
case GeckoProcessType_GMPlugin:
|
||||
case GeckoProcessType_PDFium:
|
||||
uiLoopType = MessageLoop::TYPE_DEFAULT;
|
||||
break;
|
||||
default:
|
||||
@ -652,6 +657,11 @@ XRE_InitChildProcess(int aArgc,
|
||||
process = new gmp::GMPProcessChild(parentPID);
|
||||
break;
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_ENABLE_SKIA_PDF)
|
||||
case GeckoProcessType_PDFium:
|
||||
process = new widget::PDFiumProcessChild(parentPID);
|
||||
break;
|
||||
#endif
|
||||
case GeckoProcessType_GPU:
|
||||
process = new gfx::GPUProcessImpl(parentPID);
|
||||
break;
|
||||
|
44
widget/windows/PDFiumProcessChild.cpp
Normal file
44
widget/windows/PDFiumProcessChild.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PDFiumProcessChild.h"
|
||||
|
||||
#include "mozilla/ipc/IOThreadChild.h"
|
||||
#include "mozilla/BackgroundHangMonitor.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
|
||||
using mozilla::ipc::IOThreadChild;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
PDFiumProcessChild::PDFiumProcessChild(ProcessId aParentPid)
|
||||
: ProcessChild(aParentPid)
|
||||
{
|
||||
}
|
||||
|
||||
PDFiumProcessChild::~PDFiumProcessChild()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
PDFiumProcessChild::Init(int aArgc, char* aArgv[])
|
||||
{
|
||||
BackgroundHangMonitor::Startup();
|
||||
mPDFiumActor.Init(ParentPid(),IOThreadChild::message_loop(),
|
||||
IOThreadChild::channel());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
PDFiumProcessChild::CleanUp()
|
||||
{
|
||||
BackgroundHangMonitor::Shutdown();
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
41
widget/windows/PDFiumProcessChild.h
Normal file
41
widget/windows/PDFiumProcessChild.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef PDFIUMPROCESSCHILD_H_
|
||||
#define PDFIUMPROCESSCHILD_H_
|
||||
|
||||
#include "mozilla/ipc/ProcessChild.h"
|
||||
#include "PDFiumChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
/**
|
||||
* Contains the PDFiumChild object that facilitates IPC communication to/from
|
||||
* the instance of the PDFium library that is run in this process.
|
||||
*/
|
||||
class PDFiumProcessChild final : public mozilla::ipc::ProcessChild
|
||||
{
|
||||
protected:
|
||||
typedef mozilla::ipc::ProcessChild ProcessChild;
|
||||
|
||||
public:
|
||||
explicit PDFiumProcessChild(ProcessId aParentPid);
|
||||
~PDFiumProcessChild();
|
||||
|
||||
// ProcessChild functions.
|
||||
bool Init(int aArgc, char* aArgv[]) override;
|
||||
void CleanUp() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(PDFiumProcessChild);
|
||||
|
||||
PDFiumChild mPDFiumActor;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // PDFIUMPROCESSCHILD_H_
|
43
widget/windows/PDFiumProcessParent.cpp
Normal file
43
widget/windows/PDFiumProcessParent.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=2 et :
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PDFiumProcessParent.h"
|
||||
#include "nsIRunnable.h"
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
#include "WinUtils.h"
|
||||
#endif
|
||||
#include "nsDeviceContextSpecWin.h"
|
||||
#include "PDFiumParent.h"
|
||||
|
||||
using mozilla::ipc::GeckoChildProcessHost;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
PDFiumProcessParent::PDFiumProcessParent()
|
||||
: GeckoChildProcessHost(GeckoProcessType_PDFium)
|
||||
{
|
||||
MOZ_COUNT_CTOR(PDFiumProcessParent);
|
||||
}
|
||||
|
||||
PDFiumProcessParent::~PDFiumProcessParent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(PDFiumProcessParent);
|
||||
}
|
||||
|
||||
bool
|
||||
PDFiumProcessParent::Launch()
|
||||
{
|
||||
return SyncLaunch();
|
||||
}
|
||||
|
||||
void
|
||||
PDFiumProcessParent::Delete()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
38
widget/windows/PDFiumProcessParent.h
Normal file
38
widget/windows/PDFiumProcessParent.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: sw=4 ts=4 et :
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef PDFIUMPROCESSPARENT_H
|
||||
#define PDFIUMPROCESSPARENT_H
|
||||
|
||||
#include "chrome/common/child_process_host.h"
|
||||
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
||||
|
||||
class nsIRunnable;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
class PDFiumProcessParent final : public mozilla::ipc::GeckoChildProcessHost
|
||||
{
|
||||
public:
|
||||
PDFiumProcessParent();
|
||||
~PDFiumProcessParent();
|
||||
|
||||
bool Launch();
|
||||
|
||||
void Delete();
|
||||
|
||||
bool CanShutdown() override { return true; }
|
||||
|
||||
private:
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PDFiumProcessParent);
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // ifndef PDFIUMPROCESSPARENT_H
|
@ -26,6 +26,7 @@ EXPORTS.mozilla.widget += [
|
||||
'PDFiumChild.h',
|
||||
'PDFiumEngineShim.h',
|
||||
'PDFiumParent.h',
|
||||
'PDFiumProcessChild.h',
|
||||
'PDFViaEMFPrintHelper.h',
|
||||
'WinCompositorWidget.h',
|
||||
'WinMessages.h',
|
||||
@ -108,6 +109,8 @@ if CONFIG['MOZ_ENABLE_SKIA_PDF']:
|
||||
'PDFiumChild.cpp',
|
||||
'PDFiumEngineShim.cpp',
|
||||
'PDFiumParent.cpp',
|
||||
'PDFiumProcessChild.cpp',
|
||||
'PDFiumProcessParent.cpp',
|
||||
'PDFViaEMFPrintHelper.cpp',
|
||||
'WindowsEMF.cpp',
|
||||
]
|
||||
|
@ -374,7 +374,7 @@ enum GeckoProcessType
|
||||
GeckoProcessType_GMPlugin, // Gecko Media Plugin
|
||||
|
||||
GeckoProcessType_GPU, // GPU and compositor process
|
||||
|
||||
GeckoProcessType_PDFium, // Gecko PDFium process
|
||||
GeckoProcessType_End,
|
||||
GeckoProcessType_Invalid = GeckoProcessType_End
|
||||
};
|
||||
@ -385,7 +385,8 @@ static const char* const kGeckoProcessTypeString[] = {
|
||||
"tab",
|
||||
"ipdlunittest",
|
||||
"geckomediaplugin",
|
||||
"gpu"
|
||||
"gpu",
|
||||
"pdfium"
|
||||
};
|
||||
|
||||
static_assert(MOZ_ARRAY_LENGTH(kGeckoProcessTypeString) ==
|
||||
|
@ -76,6 +76,7 @@ interface nsIXULRuntime : nsISupports
|
||||
const unsigned long PROCESS_TYPE_IPDLUNITTEST = 3;
|
||||
const unsigned long PROCESS_TYPE_GMPLUGIN = 4;
|
||||
const unsigned long PROCESS_TYPE_GPU = 5;
|
||||
const unsigned long PROCESS_TYPE_PDFIUM = 6;
|
||||
|
||||
/**
|
||||
* The type of the caller's process. Returns one of the values above.
|
||||
|
Loading…
Reference in New Issue
Block a user