Bug 1498625 - Part 2: Switch VR process to TYPE_MOZILLA_CHILD message loop type. r=froydnj,handyman

Differential Revision: https://phabricator.services.mozilla.com/D10643

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daosheng Mu 2018-11-05 21:28:38 +00:00
Родитель 764c6b0bd8
Коммит e9931800c1
10 изменённых файлов: 33 добавлений и 20 удалений

Просмотреть файл

@ -222,6 +222,11 @@ nsLayoutModuleInitialize()
gInitialized = true;
if (XRE_GetProcessType() == GeckoProcessType_VR) {
// VR process doesn't need the layout module.
return;
}
if (XRE_GetProcessType() == GeckoProcessType_GPU) {
// We mark the layout module as being available in the GPU process so that
// XPCOM's component manager initializes the power manager service, which
@ -686,7 +691,8 @@ Initialize()
static void
LayoutModuleDtor()
{
if (XRE_GetProcessType() == GeckoProcessType_GPU) {
if (XRE_GetProcessType() == GeckoProcessType_GPU ||
XRE_GetProcessType() == GeckoProcessType_VR) {
return;
}

Просмотреть файл

@ -1641,12 +1641,12 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelemetry, TelemetryImpl::CreateTele
NS_DEFINE_NAMED_CID(NS_TELEMETRY_CID);
const Module::CIDEntry kTelemetryCIDs[] = {
{ &kNS_TELEMETRY_CID, false, nullptr, nsITelemetryConstructor, Module::ALLOW_IN_GPU_PROCESS },
{ &kNS_TELEMETRY_CID, false, nullptr, nsITelemetryConstructor, Module::ALLOW_IN_GPU_AND_VR_PROCESS },
{ nullptr }
};
const Module::ContractIDEntry kTelemetryContracts[] = {
{ "@mozilla.org/base/telemetry;1", &kNS_TELEMETRY_CID, Module::ALLOW_IN_GPU_PROCESS },
{ "@mozilla.org/base/telemetry;1", &kNS_TELEMETRY_CID, Module::ALLOW_IN_GPU_AND_VR_PROCESS },
{ nullptr }
};
@ -1658,7 +1658,7 @@ const Module kTelemetryModule = {
nullptr,
nullptr,
TelemetryImpl::ShutdownTelemetry,
Module::ALLOW_IN_GPU_PROCESS
Module::ALLOW_IN_GPU_AND_VR_PROCESS
};
NS_IMETHODIMP

Просмотреть файл

@ -660,12 +660,12 @@ XRE_InitChildProcess(int aArgc,
switch (XRE_GetProcessType()) {
case GeckoProcessType_Content:
case GeckoProcessType_GPU:
case GeckoProcessType_VR:
// Content processes need the XPCOM/chromium frankenventloop
uiLoopType = MessageLoop::TYPE_MOZILLA_CHILD;
break;
case GeckoProcessType_GMPlugin:
case GeckoProcessType_PDFium:
case GeckoProcessType_VR:
uiLoopType = MessageLoop::TYPE_DEFAULT;
break;
default:

Просмотреть файл

@ -134,7 +134,7 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
mozilla::Module::MAIN_PROCESS_ONLY },
{ &kNS_COLORPICKER_CID, false, NULL, nsColorPickerConstructor,
mozilla::Module::MAIN_PROCESS_ONLY },
{ &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor, mozilla::Module::ALLOW_IN_GPU_PROCESS },
{ &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor, mozilla::Module::ALLOW_IN_GPU_AND_VR_PROCESS },
{ &kNS_SOUND_CID, false, NULL, nsSoundConstructor,
mozilla::Module::MAIN_PROCESS_ONLY },
{ &kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor },
@ -167,7 +167,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
mozilla::Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID,
mozilla::Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/widget/appshell/mac;1", &kNS_APPSHELL_CID, mozilla::Module::ALLOW_IN_GPU_PROCESS },
{ "@mozilla.org/widget/appshell/mac;1", &kNS_APPSHELL_CID, mozilla::Module::ALLOW_IN_GPU_AND_VR_PROCESS },
{ "@mozilla.org/sound;1", &kNS_SOUND_CID,
mozilla::Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID },
@ -215,7 +215,7 @@ static const mozilla::Module kWidgetModule = {
NULL,
nsAppShellInit,
nsWidgetCocoaModuleDtor,
mozilla::Module::ALLOW_IN_GPU_PROCESS
mozilla::Module::ALLOW_IN_GPU_AND_VR_PROCESS
};
NSMODULE_DEFN(nsWidgetMacModule) = &kWidgetModule;

Просмотреть файл

@ -190,7 +190,7 @@ NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
{ &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor, Module::ALLOW_IN_GPU_PROCESS },
{ &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor, Module::ALLOW_IN_GPU_AND_VR_PROCESS },
{ &kNS_COLORPICKER_CID, false, nullptr, nsColorPickerConstructor, Module::MAIN_PROCESS_ONLY },
{ &kNS_FILEPICKER_CID, false, nullptr, nsFilePickerConstructor, Module::MAIN_PROCESS_ONLY },
#ifdef MOZ_WIDGET_GTK
@ -223,7 +223,7 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
};
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/widget/appshell/gtk;1", &kNS_APPSHELL_CID, Module::ALLOW_IN_GPU_PROCESS },
{ "@mozilla.org/widget/appshell/gtk;1", &kNS_APPSHELL_CID, Module::ALLOW_IN_GPU_AND_VR_PROCESS },
{ "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, Module::MAIN_PROCESS_ONLY },
#ifdef MOZ_WIDGET_GTK
@ -283,7 +283,7 @@ static const mozilla::Module kWidgetModule = {
nullptr,
nsAppShellInit,
nsWidgetGtk2ModuleDtor,
Module::ALLOW_IN_GPU_PROCESS
Module::ALLOW_IN_GPU_AND_VR_PROCESS
};
NSMODULE_DEFN(nsWidgetGtk2Module) = &kWidgetModule;

Просмотреть файл

@ -169,7 +169,7 @@ NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
{ &kNS_FILEPICKER_CID, false, nullptr, FilePickerConstructor, Module::MAIN_PROCESS_ONLY },
{ &kNS_COLORPICKER_CID, false, nullptr, ColorPickerConstructor, Module::MAIN_PROCESS_ONLY },
{ &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor, Module::ALLOW_IN_GPU_PROCESS },
{ &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor, Module::ALLOW_IN_GPU_AND_VR_PROCESS },
{ &kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor,
Module::MAIN_PROCESS_ONLY },
{ &kNS_GFXINFO_CID, false, nullptr, GfxInfoConstructor, Module::ALLOW_IN_GPU_PROCESS },
@ -204,7 +204,7 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/widget/appshell/win;1", &kNS_APPSHELL_CID, Module::ALLOW_IN_GPU_PROCESS },
{ "@mozilla.org/widget/appshell/win;1", &kNS_APPSHELL_CID, Module::ALLOW_IN_GPU_AND_VR_PROCESS },
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID, Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID, Module::ALLOW_IN_GPU_PROCESS },
{ "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
@ -256,7 +256,7 @@ static const mozilla::Module kWidgetModule = {
nullptr,
nsAppShellInit,
nsWidgetWindowsModuleDtor,
Module::ALLOW_IN_GPU_PROCESS
Module::ALLOW_IN_GPU_AND_VR_PROCESS
};
NSMODULE_DEFN(nsWidgetModule) = &kWidgetModule;

Просмотреть файл

@ -277,7 +277,7 @@ CreateINIParserFactory(const mozilla::Module& aModule,
#define COMPONENT(NAME, Ctor) { &kNS_##NAME##_CID, false, nullptr, Ctor },
#define COMPONENT_M(NAME, Ctor, Selector) { &kNS_##NAME##_CID, false, nullptr, Ctor, Selector },
const mozilla::Module::CIDEntry kXPCOMCIDEntries[] = {
{ &kComponentManagerCID, true, nullptr, nsComponentManagerImpl::Create, Module::ALLOW_IN_GPU_PROCESS },
{ &kComponentManagerCID, true, nullptr, nsComponentManagerImpl::Create, Module::ALLOW_IN_GPU_AND_VR_PROCESS },
{ &kINIParserFactoryCID, false, CreateINIParserFactory },
#include "XPCOMModule.inc"
{ &kNS_CHROMEREGISTRY_CID, false, nullptr, nsChromeRegistryConstructor },
@ -313,7 +313,7 @@ const mozilla::Module kXPCOMModule = {
nullptr,
nullptr,
nullptr,
Module::ALLOW_IN_GPU_PROCESS
Module::ALLOW_IN_GPU_AND_VR_PROCESS
};
// gDebug will be freed during shutdown.

Просмотреть файл

@ -1,4 +1,4 @@
COMPONENT_M(MEMORY, nsMemoryImpl::Create, Module::ALLOW_IN_GPU_PROCESS)
COMPONENT_M(MEMORY, nsMemoryImpl::Create, Module::ALLOW_IN_GPU_AND_VR_PROCESS)
COMPONENT_M(DEBUG, nsDebugImpl::Create, Module::ALLOW_IN_GPU_PROCESS)
COMPONENT(ERRORSERVICE, nsErrorService::Create)
@ -14,7 +14,7 @@
COMPONENT(ARRAY, nsArrayBase::XPCOMConstructor)
COMPONENT(CONSOLESERVICE, nsConsoleServiceConstructor)
COMPONENT_M(OBSERVERSERVICE, nsObserverService::Create, Module::ALLOW_IN_GPU_PROCESS)
COMPONENT_M(OBSERVERSERVICE, nsObserverService::Create, Module::ALLOW_IN_GPU_AND_VR_PROCESS)
COMPONENT_M(TIMER, nsTimer::XPCOMConstructor, Module::ALLOW_IN_GPU_PROCESS)

Просмотреть файл

@ -52,7 +52,9 @@ struct Module
* ANY_PROCESS is specified. This flag enables a module in the
* GPU process.
*/
ALLOW_IN_GPU_PROCESS = 0x4
ALLOW_IN_GPU_PROCESS = 0x4,
ALLOW_IN_VR_PROCESS = 0x8,
ALLOW_IN_GPU_AND_VR_PROCESS = ALLOW_IN_GPU_PROCESS | ALLOW_IN_VR_PROCESS
};
/**

Просмотреть файл

@ -359,7 +359,8 @@ nsComponentManagerImpl::Init()
// used, and before any calls are made into the JS engine.
nsLayoutModuleInitialize();
bool loadChromeManifests = (XRE_GetProcessType() != GeckoProcessType_GPU);
bool loadChromeManifests = (XRE_GetProcessType() != GeckoProcessType_GPU &&
XRE_GetProcessType() != GeckoProcessType_VR);
if (loadChromeManifests) {
// The overall order in which chrome.manifests are expected to be treated
// is the following:
@ -443,6 +444,10 @@ ProcessSelectorMatches(Module::ProcessSelector aSelector)
return !!(aSelector & Module::ALLOW_IN_GPU_PROCESS);
}
if (type == GeckoProcessType_VR) {
return !!(aSelector & Module::ALLOW_IN_VR_PROCESS);
}
if (aSelector & Module::MAIN_PROCESS_ONLY) {
return type == GeckoProcessType_Default;
}