mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1539029 - pt 1 - give RDD its own process selector. r=froydnj
Originally, RDD reused the GPU process selector since they were using all the same services, and it reduced the number of places that had to be touched. Now that RDD needs pref handling, it needs its own process selector to avoid GPU inheriting pref handling. Differential Revision: https://phabricator.services.mozilla.com/D26566 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
ede6539296
commit
0b07404bf5
@ -159,14 +159,14 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(
|
||||
|
||||
static const mozilla::Module::CIDEntry kPowerManagerCIDs[] = {
|
||||
// clang-format off
|
||||
{ &kNS_POWERMANAGERSERVICE_CID, false, nullptr, nsIPowerManagerServiceConstructor, mozilla::Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS },
|
||||
{ &kNS_POWERMANAGERSERVICE_CID, false, nullptr, nsIPowerManagerServiceConstructor, mozilla::Module::ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS },
|
||||
{ nullptr }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kPowerManagerContracts[] = {
|
||||
// clang-format off
|
||||
{ POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID, mozilla::Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS },
|
||||
{ POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID, mozilla::Module::ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS },
|
||||
{ nullptr }
|
||||
// clang-format on
|
||||
};
|
||||
@ -181,4 +181,4 @@ extern const mozilla::Module kPowerManagerModule = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
mozilla::Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS};
|
||||
mozilla::Module::ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS};
|
||||
|
@ -14,6 +14,6 @@ Classes = [
|
||||
'contract_ids': ['@mozilla.org/base/telemetry;1'],
|
||||
'singleton': True,
|
||||
'type': 'nsITelemetry',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS,
|
||||
},
|
||||
]
|
||||
|
@ -135,7 +135,7 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
||||
{&kNS_COLORPICKER_CID, false, NULL, nsColorPickerConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor,
|
||||
mozilla::Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS},
|
||||
mozilla::Module::ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS},
|
||||
{&kNS_SOUND_CID, false, NULL, nsSoundConstructor, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor},
|
||||
{&kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor},
|
||||
@ -165,7 +165,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
||||
{"@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, 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_VR_AND_SOCKET_PROCESS},
|
||||
mozilla::Module::ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS},
|
||||
{"@mozilla.org/sound;1", &kNS_SOUND_CID, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID},
|
||||
{"@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID},
|
||||
@ -207,4 +207,4 @@ extern const mozilla::Module kWidgetModule = {mozilla::Module::kVersion,
|
||||
NULL,
|
||||
nsAppShellInit,
|
||||
nsWidgetCocoaModuleDtor,
|
||||
mozilla::Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS};
|
||||
mozilla::Module::ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS};
|
||||
|
@ -17,7 +17,7 @@ Classes = [
|
||||
'contract_ids': ['@mozilla.org/widget/appshell/gtk;1'],
|
||||
'legacy_constructor': 'nsAppShellConstructor',
|
||||
'headers': ['/widget/gtk/nsWidgetFactory.h'],
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{c401eb80-f9ea-11d3-bb6f-e732b73ebe7c}',
|
||||
|
@ -26,7 +26,7 @@ Classes = [
|
||||
'contract_ids': ['@mozilla.org/widget/appshell/win;1'],
|
||||
'headers': ['/widget/windows/nsWidgetFactory.h'],
|
||||
'legacy_constructor': 'nsAppShellConstructor',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}',
|
||||
@ -124,7 +124,7 @@ Classes = [
|
||||
'type': 'mozilla::widget::GfxInfo',
|
||||
'headers': ['/widget/windows/GfxInfo.h'],
|
||||
'init_method': 'Init',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{bd57cee8-1dd1-11b2-9fe7-95cf4709aea3}',
|
||||
|
@ -10,14 +10,14 @@ Classes = [
|
||||
'contract_ids': ['@mozilla.org/xpcom/debug;1'],
|
||||
'legacy_constructor': 'nsDebugImpl::Create',
|
||||
'headers': ['nsDebugImpl.h'],
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{30a04e40-38e7-11d4-8cf5-0060b0fc14a3}',
|
||||
'contract_ids': ['@mozilla.org/xpcom/memory-service;1'],
|
||||
'legacy_constructor': 'nsMemoryImpl::Create',
|
||||
'headers': ['/xpcom/base/nsMemoryImpl.h'],
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{67b3ac0c-d806-4d48-939e-6a819e6c248f}',
|
||||
|
@ -173,7 +173,7 @@ const mozilla::Module kXPCOMModule = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS};
|
||||
Module::ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS};
|
||||
|
||||
// gDebug will be freed during shutdown.
|
||||
static nsIDebug2* gDebug = nullptr;
|
||||
|
@ -67,7 +67,7 @@ Classes = [
|
||||
'type': 'nsMemoryReporterManager',
|
||||
'headers': ['/xpcom/base/nsMemoryReporterManager.h'],
|
||||
'init_method': 'Init',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{7b4eeb20-d781-11d4-8a83-0010a4e0c9ca}',
|
||||
|
@ -53,15 +53,21 @@ struct Module {
|
||||
ALLOW_IN_GPU_PROCESS = 0x4,
|
||||
ALLOW_IN_VR_PROCESS = 0x8,
|
||||
ALLOW_IN_SOCKET_PROCESS = 0x10,
|
||||
ALLOW_IN_RDD_PROCESS = 0x20,
|
||||
ALLOW_IN_GPU_AND_VR_PROCESS = ALLOW_IN_GPU_PROCESS | ALLOW_IN_VR_PROCESS,
|
||||
ALLOW_IN_GPU_AND_SOCKET_PROCESS =
|
||||
ALLOW_IN_GPU_PROCESS | ALLOW_IN_SOCKET_PROCESS,
|
||||
ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS =
|
||||
ALLOW_IN_GPU_PROCESS | ALLOW_IN_VR_PROCESS | ALLOW_IN_SOCKET_PROCESS
|
||||
ALLOW_IN_GPU_PROCESS | ALLOW_IN_VR_PROCESS | ALLOW_IN_SOCKET_PROCESS,
|
||||
ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS =
|
||||
ALLOW_IN_GPU_PROCESS | ALLOW_IN_RDD_PROCESS | ALLOW_IN_SOCKET_PROCESS,
|
||||
ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS =
|
||||
ALLOW_IN_GPU_PROCESS | ALLOW_IN_RDD_PROCESS |
|
||||
ALLOW_IN_VR_PROCESS | ALLOW_IN_SOCKET_PROCESS
|
||||
};
|
||||
|
||||
static constexpr size_t kMaxProcessSelector =
|
||||
size_t(ProcessSelector::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS);
|
||||
size_t(ProcessSelector::ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS);
|
||||
|
||||
/**
|
||||
* The constructor callback is an implementation detail of the default binary
|
||||
|
@ -10,12 +10,12 @@ Classes = [
|
||||
'contract_ids': ['@mozilla.org/categorymanager;1'],
|
||||
'legacy_constructor': 'nsCategoryManager::Create',
|
||||
'headers': ['/xpcom/components/nsCategoryManager.h'],
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{91775d60-d5dc-11d2-92fb-00e09805570f}',
|
||||
'legacy_constructor': 'nsComponentManagerImpl::Create',
|
||||
'headers': ['/xpcom/components/nsComponentManager.h'],
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS,
|
||||
},
|
||||
]
|
||||
|
@ -62,12 +62,20 @@ class ProcessSelector:
|
||||
ALLOW_IN_GPU_PROCESS = 0x4
|
||||
ALLOW_IN_VR_PROCESS = 0x8
|
||||
ALLOW_IN_SOCKET_PROCESS = 0x10
|
||||
ALLOW_IN_RDD_PROCESS = 0x20
|
||||
ALLOW_IN_GPU_AND_SOCKET_PROCESS = (ALLOW_IN_GPU_PROCESS |
|
||||
ALLOW_IN_SOCKET_PROCESS)
|
||||
ALLOW_IN_GPU_AND_VR_PROCESS = ALLOW_IN_GPU_PROCESS | ALLOW_IN_VR_PROCESS
|
||||
ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS = (ALLOW_IN_GPU_PROCESS |
|
||||
ALLOW_IN_VR_PROCESS |
|
||||
ALLOW_IN_SOCKET_PROCESS)
|
||||
ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS = (ALLOW_IN_GPU_PROCESS |
|
||||
ALLOW_IN_RDD_PROCESS |
|
||||
ALLOW_IN_SOCKET_PROCESS)
|
||||
ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS = (ALLOW_IN_GPU_PROCESS |
|
||||
ALLOW_IN_RDD_PROCESS |
|
||||
ALLOW_IN_VR_PROCESS |
|
||||
ALLOW_IN_SOCKET_PROCESS)
|
||||
|
||||
|
||||
# Maps ProcessSelector constants to the name of the corresponding
|
||||
@ -79,9 +87,14 @@ PROCESSES = {
|
||||
ProcessSelector.ALLOW_IN_GPU_PROCESS: 'ALLOW_IN_GPU_PROCESS',
|
||||
ProcessSelector.ALLOW_IN_VR_PROCESS: 'ALLOW_IN_VR_PROCESS',
|
||||
ProcessSelector.ALLOW_IN_SOCKET_PROCESS: 'ALLOW_IN_SOCKET_PROCESS',
|
||||
ProcessSelector.ALLOW_IN_RDD_PROCESS: 'ALLOW_IN_RDD_PROCESS',
|
||||
ProcessSelector.ALLOW_IN_GPU_AND_SOCKET_PROCESS: 'ALLOW_IN_GPU_AND_SOCKET_PROCESS',
|
||||
ProcessSelector.ALLOW_IN_GPU_AND_VR_PROCESS: 'ALLOW_IN_GPU_AND_VR_PROCESS',
|
||||
ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS: 'ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS',
|
||||
ProcessSelector.ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS:
|
||||
'ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS',
|
||||
ProcessSelector.ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS:
|
||||
'ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS',
|
||||
}
|
||||
|
||||
|
||||
|
@ -143,10 +143,14 @@ using ProcessSelector = Module::ProcessSelector;
|
||||
// Module.h.
|
||||
bool ProcessSelectorMatches(ProcessSelector aSelector) {
|
||||
GeckoProcessType type = XRE_GetProcessType();
|
||||
if (type == GeckoProcessType_GPU || type == GeckoProcessType_RDD) {
|
||||
if (type == GeckoProcessType_GPU) {
|
||||
return !!(aSelector & Module::ALLOW_IN_GPU_PROCESS);
|
||||
}
|
||||
|
||||
if (type == GeckoProcessType_RDD) {
|
||||
return !!(aSelector & Module::ALLOW_IN_RDD_PROCESS);
|
||||
}
|
||||
|
||||
if (type == GeckoProcessType_Socket) {
|
||||
return !!(aSelector & (Module::ALLOW_IN_SOCKET_PROCESS));
|
||||
}
|
||||
@ -424,6 +428,8 @@ nsresult nsComponentManagerImpl::Init() {
|
||||
ProcessSelectorMatches(ProcessSelector::ALLOW_IN_VR_PROCESS);
|
||||
gProcessMatchTable[size_t(ProcessSelector::ALLOW_IN_SOCKET_PROCESS)] =
|
||||
ProcessSelectorMatches(ProcessSelector::ALLOW_IN_SOCKET_PROCESS);
|
||||
gProcessMatchTable[size_t(ProcessSelector::ALLOW_IN_RDD_PROCESS)] =
|
||||
ProcessSelectorMatches(ProcessSelector::ALLOW_IN_RDD_PROCESS);
|
||||
gProcessMatchTable[size_t(ProcessSelector::ALLOW_IN_GPU_AND_VR_PROCESS)] =
|
||||
ProcessSelectorMatches(ProcessSelector::ALLOW_IN_GPU_AND_VR_PROCESS);
|
||||
gProcessMatchTable[size_t(
|
||||
@ -434,6 +440,14 @@ nsresult nsComponentManagerImpl::Init() {
|
||||
ProcessSelector::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS)] =
|
||||
ProcessSelectorMatches(
|
||||
ProcessSelector::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS);
|
||||
gProcessMatchTable[size_t(
|
||||
ProcessSelector::ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS)] =
|
||||
ProcessSelectorMatches(
|
||||
ProcessSelector::ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS);
|
||||
gProcessMatchTable[size_t(
|
||||
ProcessSelector::ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS)] =
|
||||
ProcessSelectorMatches(
|
||||
ProcessSelector::ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(NOT_INITIALIZED == mStatus);
|
||||
|
@ -16,6 +16,6 @@ Classes = [
|
||||
'contract_ids': ['@mozilla.org/observer-service;1'],
|
||||
'legacy_constructor': 'nsObserverService::Create',
|
||||
'headers': ['/xpcom/ds/nsObserverService.h'],
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS,
|
||||
},
|
||||
]
|
||||
|
@ -16,6 +16,6 @@ Classes = [
|
||||
'contract_ids': ['@mozilla.org/timer;1'],
|
||||
'legacy_constructor': 'nsTimer::XPCOMConstructor',
|
||||
'headers': ['/xpcom/threads/nsTimerImpl.h'],
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_AND_SOCKET_PROCESS,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS,
|
||||
},
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user