Bug 1478124: Part 8e - Update XPCOM module to use a static component manifest. r=froydnj
☠☠ backed out by 1e042fc7de3d ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Tue, 18 Dec 2018 20:28:14 -0800
changeset 455932 012fd0107204da802f04b7c133b33a5dd22123a4
parent 455931 496aaf774697f817a689ee0d59f2f866fdb16801
child 455933 8dacce59fcc0c966a3753b3ced9b1afd0043475a
push id35463
push usershindli@mozilla.com
push dateTue, 29 Jan 2019 21:38:17 +0000
treeherdermozilla-central@4440fbf71c72 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1478124
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1478124: Part 8e - Update XPCOM module to use a static component manifest. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D15043
xpcom/base/components.conf
xpcom/base/moz.build
xpcom/build/XPCOMInit.cpp
xpcom/build/XPCOMModule.h
xpcom/build/XPCOMModule.inc
xpcom/build/components.conf
xpcom/build/moz.build
xpcom/components/components.conf
xpcom/components/moz.build
xpcom/components/nsComponentManager.cpp
xpcom/ds/components.conf
xpcom/ds/moz.build
xpcom/io/components.conf
xpcom/io/moz.build
xpcom/threads/components.conf
xpcom/threads/moz.build
new file mode 100644
--- /dev/null
+++ b/xpcom/base/components.conf
@@ -0,0 +1,28 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+Classes = [
+    {
+        'cid': '{cb6cdb94-e417-4601-b4a5-f991bf41453d}',
+        'contract_ids': ['@mozilla.org/xpcom/debug;1'],
+        'legacy_constructor': 'nsDebugImpl::Create',
+        'headers': ['nsDebugImpl.h'],
+        'processes': ProcessSelector.ALLOW_IN_GPU_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,
+    },
+    {
+        'cid': '{67b3ac0c-d806-4d48-939e-6a819e6c248f}',
+        'contract_ids': ['@mozilla.org/message-loop;1'],
+        'legacy_constructor': 'nsMessageLoopConstructor',
+        'headers': ['/xpcom/base/nsMessageLoop.h'],
+    },
+]
--- a/xpcom/base/moz.build
+++ b/xpcom/base/moz.build
@@ -40,16 +40,20 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
     UNIFIED_SOURCES += [
         'MacHelpers.mm',
         'MacStringHelpers.mm',
         'nsMacPreferencesReader.mm',
     ]
 
 XPIDL_MODULE = 'xpcom_base'
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 EXPORTS += [
     '!ErrorList.h',
     '!ErrorNamesInternal.h',
     'CodeAddressService.h',
     'nsAgg.h',
     'nsAlgorithm.h',
     'nsAutoPtr.h',
     'nsAutoRef.h',
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -1,14 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "XPCOMModule.h"
+
 #include "base/basictypes.h"
 
 #include "mozilla/Atomics.h"
 #include "mozilla/Poison.h"
 #include "mozilla/RemoteDecoderManagerChild.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/VideoDecoderManagerChild.h"
 #include "mozilla/XPCOM.h"
@@ -22,103 +24,61 @@
 #include "nsXPCOMCIDInternal.h"
 
 #include "mozilla/layers/ImageBridgeChild.h"
 #include "mozilla/layers/CompositorBridgeParent.h"
 
 #include "prlink.h"
 
 #include "nsCycleCollector.h"
-#include "nsObserverList.h"
 #include "nsObserverService.h"
-#include "nsScriptableInputStream.h"
-#include "nsBinaryStream.h"
-#include "nsStorageStream.h"
-#include "nsPipe.h"
-#include "nsScriptableBase64Encoder.h"
 
-#include "nsMemoryImpl.h"
 #include "nsDebugImpl.h"
-#include "nsTraceRefcnt.h"
+#include "nsSystemInfo.h"
 
-#include "nsArray.h"
 #include "nsINIParserImpl.h"
-#include "nsSupportsPrimitives.h"
-#include "nsConsoleService.h"
 
 #include "nsComponentManager.h"
 #include "nsCategoryManagerUtils.h"
 #include "nsIServiceManager.h"
 
 #include "nsThreadManager.h"
 #include "nsThreadPool.h"
 
 #include "nsTimerImpl.h"
 #include "TimerThread.h"
 
 #include "nsThread.h"
-#include "nsProcess.h"
-#include "nsEnvironment.h"
 #include "nsVersionComparatorImpl.h"
 
 #include "nsIFile.h"
 #include "nsLocalFile.h"
-#if defined(XP_UNIX)
-#  include "nsNativeCharsetUtils.h"
-#endif
 #include "nsDirectoryService.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsCategoryManager.h"
 #include "nsICategoryManager.h"
 #include "nsMultiplexInputStream.h"
 
-#include "nsStringStream.h"
-extern nsresult nsStringInputStreamConstructor(nsISupports*, REFNSIID, void**);
-
 #include "nsAtomTable.h"
 #include "nsISupportsImpl.h"
 
-#include "nsHashPropertyBag.h"
-
-#include "nsUnicharInputStream.h"
-#include "nsVariant.h"
-
-#include "nsUUIDGenerator.h"
-
-#include "nsIOUtil.h"
-
-#include "SpecialSystemDirectory.h"
-
-#if defined(XP_WIN)
-#  include "nsWindowsRegKey.h"
-#endif
-
-#ifdef MOZ_WIDGET_COCOA
-#  include "nsMacUtilsImpl.h"
-#  include "nsMacPreferencesReader.h"
-#endif
-
 #include "nsSystemInfo.h"
 #include "nsMemoryReporterManager.h"
-#include "nsMemoryInfoDumper.h"
-#include "nsSecurityConsoleMessage.h"
 #include "nsMessageLoop.h"
 #include "nss.h"
 #include "ssl.h"
 
 #include <locale.h>
 #include "mozilla/Services.h"
 #include "mozilla/Omnijar.h"
 #include "mozilla/ScriptPreloader.h"
 #include "mozilla/SystemGroup.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/BackgroundHangMonitor.h"
 
-#include "nsChromeRegistry.h"
-#include "nsChromeProtocolHandler.h"
 #include "mozilla/PoisonIOInterposer.h"
 #include "mozilla/LateWriteChecks.h"
 
 #include "mozilla/scache/StartupCache.h"
 
 #include "base/at_exit.h"
 #include "base/command_line.h"
 #include "base/message_loop.h"
@@ -165,146 +125,51 @@ static BackgroundHangMonitor* sMainHangM
 // here rather than in nsIRegistry.h
 extern nsresult NS_RegistryGetFactory(nsIFactory** aFactory);
 extern nsresult NS_CategoryManagerGetFactory(nsIFactory**);
 
 #ifdef XP_WIN
 extern nsresult CreateAnonTempFileRemover();
 #endif
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsProcess)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsID)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsString)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsCString)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRBool)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint8)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint16)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint32)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint64)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRTime)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsChar)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt16)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt32)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt64)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsFloat)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsDouble)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsInterfacePointer)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsConsoleService, Init)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryOutputStream)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryInputStream)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsStorageStream)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsVersionComparatorImpl)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableBase64Encoder)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsVariantCC)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsHashPropertyBagCC)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUUIDGenerator, Init)
-
-#ifdef MOZ_WIDGET_COCOA
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacUtilsImpl)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacPreferencesReader)
-#endif
-
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemInfo, Init)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMemoryReporterManager, Init)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsMemoryInfoDumper)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsIOUtil)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSecurityConsoleMessage)
-
-static nsresult nsThreadManagerGetSingleton(nsISupports* aOuter,
-                                            const nsIID& aIID,
-                                            void** aInstancePtr) {
+nsresult nsThreadManagerGetSingleton(nsISupports* aOuter, const nsIID& aIID,
+                                     void** aInstancePtr) {
   NS_ASSERTION(aInstancePtr, "null outptr");
   if (NS_WARN_IF(aOuter)) {
     return NS_ERROR_NO_AGGREGATION;
   }
 
   return nsThreadManager::get().QueryInterface(aIID, aInstancePtr);
 }
 
+nsresult nsLocalFileConstructor(nsISupports* aOuter, const nsIID& aIID,
+                                void** aInstancePtr) {
+  return nsLocalFile::nsLocalFileConstructor(aOuter, aIID, aInstancePtr);
+}
+
 nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = nullptr;
 bool gXPCOMShuttingDown = false;
 bool gXPCOMThreadsShutDown = false;
 char16_t* gGREBinPath = nullptr;
 
-static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
 static NS_DEFINE_CID(kINIParserFactoryCID, NS_INIPARSERFACTORY_CID);
 
-NS_DEFINE_NAMED_CID(NS_CHROMEREGISTRY_CID);
-NS_DEFINE_NAMED_CID(NS_CHROMEPROTOCOLHANDLER_CID);
-
-NS_DEFINE_NAMED_CID(NS_SECURITY_CONSOLE_MESSAGE_CID);
-
-#ifdef MOZ_WIDGET_COCOA
-NS_DEFINE_NAMED_CID(NS_MACPREFERENCESREADER_CID);
-#endif
-
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsChromeRegistry,
-                                         nsChromeRegistry::GetSingleton)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsChromeProtocolHandler)
-
 static already_AddRefed<nsIFactory> CreateINIParserFactory(
     const mozilla::Module& aModule, const mozilla::Module::CIDEntry& aEntry) {
   nsCOMPtr<nsIFactory> f = new nsINIParserFactory();
   return f.forget();
 }
 
-#define COMPONENT(NAME, Ctor) \
-  static NS_DEFINE_CID(kNS_##NAME##_CID, NS_##NAME##_CID);
-#define COMPONENT_M(NAME, Ctor, Selector) \
-  static NS_DEFINE_CID(kNS_##NAME##_CID, NS_##NAME##_CID);
-#include "XPCOMModule.inc"
-#undef COMPONENT
-#undef COMPONENT_M
-
-#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_VR_AND_SOCKET_PROCESS},
     {&kINIParserFactoryCID, false, CreateINIParserFactory},
-#include "XPCOMModule.inc"
-    {&kNS_CHROMEREGISTRY_CID, false, nullptr, nsChromeRegistryConstructor},
-    {&kNS_CHROMEPROTOCOLHANDLER_CID, false, nullptr,
-     nsChromeProtocolHandlerConstructor},
-    {&kNS_SECURITY_CONSOLE_MESSAGE_CID, false, nullptr,
-     nsSecurityConsoleMessageConstructor},
-#ifdef MOZ_WIDGET_COCOA
-    {&kNS_MACPREFERENCESREADER_CID, false, nullptr,
-     nsMacPreferencesReaderConstructor},
-#endif
     {nullptr}};
-#undef COMPONENT
-#undef COMPONENT_M
 
-#define COMPONENT(NAME, Ctor) {NS_##NAME##_CONTRACTID, &kNS_##NAME##_CID},
-#define COMPONENT_M(NAME, Ctor, Selector) \
-  {NS_##NAME##_CONTRACTID, &kNS_##NAME##_CID, Selector},
 const mozilla::Module::ContractIDEntry kXPCOMContracts[] = {
-#include "XPCOMModule.inc"
-    {NS_CHROMEREGISTRY_CONTRACTID, &kNS_CHROMEREGISTRY_CID},
-    {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "chrome",
-     &kNS_CHROMEPROTOCOLHANDLER_CID},
     {NS_INIPARSERFACTORY_CONTRACTID, &kINIParserFactoryCID},
-    {NS_SECURITY_CONSOLE_MESSAGE_CONTRACTID, &kNS_SECURITY_CONSOLE_MESSAGE_CID},
-#ifdef MOZ_WIDGET_COCOA
-    {NS_MACPREFERENCESREADER_CONTRACTID, &kNS_MACPREFERENCESREADER_CID},
-#endif
     {nullptr}};
-#undef COMPONENT
-#undef COMPONENT_M
 
 const mozilla::Module kXPCOMModule = {
     mozilla::Module::kVersion,
     kXPCOMCIDEntries,
     kXPCOMContracts,
     nullptr,
     nullptr,
     nullptr,
new file mode 100644
--- /dev/null
+++ b/xpcom/build/XPCOMModule.h
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* 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 XPCOMModule_h
+#define XPCOMModule_h
+
+#include "nsID.h"
+
+class nsISupports;
+
+nsresult nsThreadManagerGetSingleton(nsISupports* aOuter, const nsIID& aIID,
+                                     void** aInstancePtr);
+
+nsresult nsLocalFileConstructor(nsISupports* aOuter, const nsIID& aIID,
+                                void** aInstancePtr);
+
+extern nsresult nsStringInputStreamConstructor(nsISupports*, const nsID&,
+                                               void**);
+
+#endif  // XPCOMModule_h
--- a/xpcom/build/XPCOMModule.inc
+++ b/xpcom/build/XPCOMModule.inc
@@ -1,69 +1,3 @@
-    COMPONENT_M(MEMORY, nsMemoryImpl::Create, Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS)
-    COMPONENT_M(DEBUG,  nsDebugImpl::Create, Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS)
-
-    COMPONENT_M(CATEGORYMANAGER, nsCategoryManager::Create, Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS)
-
-    COMPONENT(SCRIPTABLEINPUTSTREAM, nsScriptableInputStream::Create)
-    COMPONENT(BINARYINPUTSTREAM, nsBinaryInputStreamConstructor)
-    COMPONENT(BINARYOUTPUTSTREAM, nsBinaryOutputStreamConstructor)
-    COMPONENT(STORAGESTREAM, nsStorageStreamConstructor)
-    COMPONENT(VERSIONCOMPARATOR, nsVersionComparatorImplConstructor)
-    COMPONENT(SCRIPTABLEBASE64ENCODER, nsScriptableBase64EncoderConstructor)
-    COMPONENT(PIPE, nsPipeConstructor)
-
-    COMPONENT(ARRAY, nsArrayBase::XPCOMConstructor)
-    COMPONENT(CONSOLESERVICE, nsConsoleServiceConstructor)
-    COMPONENT_M(OBSERVERSERVICE, nsObserverService::Create, Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS)
-
-    COMPONENT_M(TIMER, nsTimer::XPCOMConstructor, Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS)
-
-#define COMPONENT_SUPPORTS(TYPE, Type)                                         \
-  COMPONENT(SUPPORTS_##TYPE, nsSupports##Type##Constructor)
-
-    COMPONENT_SUPPORTS(ID, ID)
-    COMPONENT_SUPPORTS(STRING, String)
-    COMPONENT_SUPPORTS(CSTRING, CString)
-    COMPONENT_SUPPORTS(PRBOOL, PRBool)
-    COMPONENT_SUPPORTS(PRUINT8, PRUint8)
-    COMPONENT_SUPPORTS(PRUINT16, PRUint16)
-    COMPONENT_SUPPORTS(PRUINT32, PRUint32)
-    COMPONENT_SUPPORTS(PRUINT64, PRUint64)
-    COMPONENT_SUPPORTS(PRTIME, PRTime)
-    COMPONENT_SUPPORTS(CHAR, Char)
-    COMPONENT_SUPPORTS(PRINT16, PRInt16)
-    COMPONENT_SUPPORTS(PRINT32, PRInt32)
-    COMPONENT_SUPPORTS(PRINT64, PRInt64)
-    COMPONENT_SUPPORTS(FLOAT, Float)
-    COMPONENT_SUPPORTS(DOUBLE, Double)
-    COMPONENT_SUPPORTS(INTERFACE_POINTER, InterfacePointer)
-
-#undef COMPONENT_SUPPORTS
-    COMPONENT(LOCAL_FILE, nsLocalFile::nsLocalFileConstructor)
-    COMPONENT(DIRECTORY_SERVICE, nsDirectoryService::Create)
-    COMPONENT(PROCESS, nsProcessConstructor)
-    COMPONENT(ENVIRONMENT, nsEnvironment::Create)
-
-    COMPONENT(THREADMANAGER, nsThreadManagerGetSingleton)
-
-    COMPONENT(STRINGINPUTSTREAM, nsStringInputStreamConstructor)
-    COMPONENT(MULTIPLEXINPUTSTREAM, nsMultiplexInputStreamConstructor)
-
-    COMPONENT(VARIANT, nsVariantCCConstructor)
-
-    COMPONENT(HASH_PROPERTY_BAG, nsHashPropertyBagCCConstructor)
-
-    COMPONENT(UUID_GENERATOR, nsUUIDGeneratorConstructor)
-
 #if defined(XP_WIN)
     COMPONENT(WINDOWSREGKEY, nsWindowsRegKeyConstructor)
 #endif
-
-#if defined(MOZ_WIDGET_COCOA)
-    COMPONENT(MACUTILSIMPL, nsMacUtilsImplConstructor)
-#endif
-
-    COMPONENT(SYSTEMINFO, nsSystemInfoConstructor)
-    COMPONENT_M(MEMORY_REPORTER_MANAGER, nsMemoryReporterManagerConstructor, Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS)
-    COMPONENT(MEMORY_INFO_DUMPER, nsMemoryInfoDumperConstructor)
-    COMPONENT(IOUTIL, nsIOUtilConstructor)
-    COMPONENT(MESSAGE_LOOP, nsMessageLoopConstructor)
new file mode 100644
--- /dev/null
+++ b/xpcom/build/components.conf
@@ -0,0 +1,250 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+Classes = [
+    {
+        'cid': '{c521a612-2aad-46db-b6ab-3b821fb150b1}',
+        'contract_ids': ['@mozilla.org/binaryinputstream;1'],
+        'type': 'nsBinaryInputStream',
+        'headers': ['/xpcom/io/nsBinaryStream.h'],
+    },
+    {
+        'cid': '{86c37b9a-74e7-4672-844e-6e7dd83ba484}',
+        'contract_ids': ['@mozilla.org/binaryoutputstream;1'],
+        'type': 'nsBinaryOutputStream',
+        'headers': ['/xpcom/io/nsBinaryStream.h'],
+    },
+    {
+        'cid': '{61ba33c0-3031-11d3-8cd0-0060b0fc14a3}',
+        'contract_ids': ['@mozilla.org/network/protocol;1?name=chrome'],
+        'type': 'nsChromeProtocolHandler',
+        'headers': ['/chrome/nsChromeProtocolHandler.h'],
+    },
+    {
+        'cid': '{47049e42-1d87-482a-984d-56ae185e367a}',
+        'contract_ids': ['@mozilla.org/chrome/chrome-registry;1'],
+        'singleton': True,
+        'type': 'nsChromeRegistry',
+        'headers': ['/chrome/nsChromeRegistry.h'],
+        'constructor': 'nsChromeRegistry::GetSingleton',
+    },
+    {
+        'cid': '{7e3ff85c-1dd2-11b2-8d4b-eb452cb0ff40}',
+        'contract_ids': ['@mozilla.org/consoleservice;1'],
+        'type': 'nsConsoleService',
+        'headers': ['/xpcom/base/nsConsoleService.h'],
+        'init_method': 'Init',
+    },
+    {
+        'cid': '{678c50b8-6bcb-4ad0-b9b8-c81175955199}',
+        'contract_ids': ['@mozilla.org/hash-property-bag;1'],
+        'type': 'nsHashPropertyBagCC',
+        'headers': ['nsHashPropertyBag.h'],
+    },
+    {
+        'cid': '{eb833911-4f49-4623-845f-e58a8e6de4c2}',
+        'contract_ids': ['@mozilla.org/io-util;1'],
+        'type': 'nsIOUtil',
+        'headers': ['/xpcom/io/nsIOUtil.h'],
+    },
+    {
+        'cid': '{2e23e220-60be-11d3-8c4a-000064657374}',
+        'contract_ids': ['@mozilla.org/file/local;1'],
+        'legacy_constructor': 'nsLocalFileConstructor',
+    },
+    {
+        'cid': '{00bd71fb-7f09-4ec3-96af-a0b522b77969}',
+        'contract_ids': ['@mozilla.org/memory-info-dumper;1'],
+        'type': 'nsMemoryInfoDumper',
+        'headers': ['mozilla/nsMemoryInfoDumper.h'],
+    },
+    {
+        'cid': '{fb97e4f5-32dd-497a-baa2-7d1e55079910}',
+        'contract_ids': ['@mozilla.org/memory-reporter-manager;1'],
+        'type': 'nsMemoryReporterManager',
+        'headers': ['/xpcom/base/nsMemoryReporterManager.h'],
+        'init_method': 'Init',
+        'processes': ProcessSelector.ALLOW_IN_GPU_AND_SOCKET_PROCESS,
+    },
+    {
+        'cid': '{7b4eeb20-d781-11d4-8a83-0010a4e0c9ca}',
+        'contract_ids': ['@mozilla.org/process/util;1'],
+        'type': 'nsProcess',
+        'headers': ['nsProcess.h'],
+    },
+    {
+        'cid': '{aaf68860-f849-40ee-bb7a-b229bce036a3}',
+        'contract_ids': ['@mozilla.org/scriptablebase64encoder;1'],
+        'type': 'nsScriptableBase64Encoder',
+        'headers': ['/xpcom/io/nsScriptableBase64Encoder.h'],
+    },
+    {
+        'cid': '{43ebf210-8a7b-4ddb-a83d-b87c51a058db}',
+        'contract_ids': ['@mozilla.org/securityconsole/message;1'],
+        'type': 'nsSecurityConsoleMessage',
+        'headers': ['/xpcom/base/nsSecurityConsoleMessage.h'],
+    },
+    {
+        'cid': '{669a9795-6ff7-4ed4-9150-c34ce2971b63}',
+        'contract_ids': ['@mozilla.org/storagestream;1'],
+        'type': 'nsStorageStream',
+        'headers': ['nsStorageStream.h'],
+    },
+    {
+        'cid': '{acf8dc41-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-cstring;1'],
+        'type': 'nsSupportsCString',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc4a-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-char;1'],
+        'type': 'nsSupportsChar',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{cbf86871-4ac0-11d3-baea-00805f8a5dd7}',
+        'contract_ids': ['@mozilla.org/supports-double;1'],
+        'type': 'nsSupportsDouble',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{cbf86870-4ac0-11d3-baea-00805f8a5dd7}',
+        'contract_ids': ['@mozilla.org/supports-float;1'],
+        'type': 'nsSupportsFloat',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc40-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-id;1'],
+        'type': 'nsSupportsID',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{a99febba-1dd1-11b2-a943-b02334a6d083}',
+        'contract_ids': ['@mozilla.org/supports-interface-pointer;1'],
+        'type': 'nsSupportsInterfacePointer',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc43-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-PRBool;1'],
+        'type': 'nsSupportsPRBool',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc4b-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-PRInt16;1'],
+        'type': 'nsSupportsPRInt16',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc4c-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-PRInt32;1'],
+        'type': 'nsSupportsPRInt32',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc4d-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-PRInt64;1'],
+        'type': 'nsSupportsPRInt64',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc49-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-PRTime;1'],
+        'type': 'nsSupportsPRTime',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc46-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-PRUint16;1'],
+        'type': 'nsSupportsPRUint16',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc47-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-PRUint32;1'],
+        'type': 'nsSupportsPRUint32',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc48-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-PRUint64;1'],
+        'type': 'nsSupportsPRUint64',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc44-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-PRUint8;1'],
+        'type': 'nsSupportsPRUint8',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{acf8dc42-4a25-11d3-9890-006008962422}',
+        'contract_ids': ['@mozilla.org/supports-string;1'],
+        'type': 'nsSupportsString',
+        'headers': ['nsSupportsPrimitives.h'],
+    },
+    {
+        'cid': '{d962398a-99e5-49b2-857a-c159049c7f6c}',
+        'contract_ids': ['@mozilla.org/system-info;1'],
+        'type': 'nsSystemInfo',
+        'headers': ['nsSystemInfo.h'],
+        'init_method': 'Init',
+    },
+    {
+        'cid': '{7a4204c6-e45a-4c37-8ebb-6709a22c917c}',
+        'contract_ids': ['@mozilla.org/thread-manager;1'],
+        'legacy_constructor': 'nsThreadManagerGetSingleton',
+        'headers': ['/xpcom/build/XPCOMModule.h'],
+    },
+    {
+        'cid': '{706d36bb-bf79-4293-81f2-8f6828c18f9d}',
+        'contract_ids': ['@mozilla.org/uuid-generator;1'],
+        'type': 'nsUUIDGenerator',
+        'headers': ['/xpcom/base/nsUUIDGenerator.h'],
+        'init_method': 'Init',
+    },
+    {
+        'cid': '{0d6ea1d0-879c-11d5-90ef-0010a4e73d9a}',
+        'contract_ids': ['@mozilla.org/variant;1'],
+        'type': 'nsVariantCC',
+        'headers': ['nsVariant.h'],
+    },
+    {
+        'cid': '{c6e47036-ca94-4be3-963a-9abd8705f7a8}',
+        'contract_ids': ['@mozilla.org/xpcom/version-comparator;1'],
+        'type': 'nsVersionComparatorImpl',
+        'headers': ['/xpcom/base/nsVersionComparatorImpl.h'],
+    },
+]
+
+if buildconfig.substs['OS_ARCH'] == 'WINNT':
+    Classes += [
+        {
+            'cid': '{a53bc624-d577-4839-b8ec-bb5040a52ff4}',
+            'contract_ids': ['@mozilla.org/windows-registry-key;1'],
+            'legacy_constructor': 'nsWindowsRegKeyConstructor',
+            'headers': ['nsWindowsRegKey.h'],
+        },
+    ]
+
+if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+    Classes += [
+        {
+            'cid': '{b0f20595-88ce-4738-a1a4-24de78eb8051}',
+            'contract_ids': ['@mozilla.org/mac-preferences-reader;1'],
+            'type': 'nsMacPreferencesReader',
+            'headers': ['mozilla/nsMacPreferencesReader.h'],
+        },
+        {
+            'cid': '{697bd3fd-43e5-41ce-ad5e-c339175c0818}',
+            'contract_ids': ['@mozilla.org/xpcom/mac-utils;1'],
+            'type': 'nsMacUtilsImpl',
+            'headers': ['/xpcom/base/nsMacUtilsImpl.h'],
+        },
+    ]
--- a/xpcom/build/moz.build
+++ b/xpcom/build/moz.build
@@ -45,16 +45,20 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
     ]
     SOURCES += ['mach_override.c']
     SOURCES['mach_override.c'].flags += ['-Wno-unused-function']
 else:
     SOURCES += ['PoisonIOInterposerStub.cpp']
 
 include('../glue/objs.mozbuild')
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 UNIFIED_SOURCES += xpcom_gluens_src_cppsrcs
 UNIFIED_SOURCES += xpcom_glue_src_cppsrcs
 
 UNIFIED_SOURCES += [
     'FileLocation.cpp',
     'IOInterposer.cpp',
     'LateWriteChecks.cpp',
     'MainThreadIOLogger.cpp',
new file mode 100644
--- /dev/null
+++ b/xpcom/components/components.conf
@@ -0,0 +1,21 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+Classes = [
+    {
+        'cid': '{16d222a6-1dd2-11b2-b693-f38b02c021b2}',
+        'contract_ids': ['@mozilla.org/categorymanager;1'],
+        'legacy_constructor': 'nsCategoryManager::Create',
+        'headers': ['/xpcom/components/nsCategoryManager.h'],
+        'processes': ProcessSelector.ALLOW_IN_GPU_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,
+    },
+]
--- a/xpcom/components/moz.build
+++ b/xpcom/components/moz.build
@@ -24,16 +24,20 @@ EXPORTS += [
 ]
 
 EXPORTS.mozilla += [
     'GenericFactory.h',
     'Module.h',
     'ModuleUtils.h',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 if CONFIG['COMPILE_ENVIRONMENT']:
     EXPORTS.mozilla += [
         '!Components.h',
     ]
 
     generated = ('Components.h', 'StaticComponentData.h',
                  'StaticComponents.cpp')
 
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -332,17 +332,17 @@ nsresult nsComponentManagerImpl::Create(
 
   if (!gComponentManager) {
     return NS_ERROR_FAILURE;
   }
 
   return gComponentManager->QueryInterface(aIID, aResult);
 }
 
-static const int CONTRACTID_HASHTABLE_INITIAL_LENGTH = 512;
+static const int CONTRACTID_HASHTABLE_INITIAL_LENGTH = 256;
 
 nsComponentManagerImpl::nsComponentManagerImpl()
     : mFactories(CONTRACTID_HASHTABLE_INITIAL_LENGTH),
       mContractIDs(CONTRACTID_HASHTABLE_INITIAL_LENGTH),
       mLock("nsComponentManagerImpl.mLock"),
       mStatus(NOT_INITIALIZED) {}
 
 static nsTArray<const mozilla::Module*>* sExtraStaticModules;
new file mode 100644
--- /dev/null
+++ b/xpcom/ds/components.conf
@@ -0,0 +1,21 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+Classes = [
+    {
+        'cid': '{35c66fd1-95e9-4e0a-80c5-c3bd2b375481}',
+        'contract_ids': ['@mozilla.org/array;1'],
+        'legacy_constructor': 'nsArrayBase::XPCOMConstructor',
+        'headers': ['nsArray.h'],
+    },
+    {
+        'cid': '{d07f5195-e3d1-11d2-8acd-00105a1b8860}',
+        '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,
+    },
+]
--- a/xpcom/ds/moz.build
+++ b/xpcom/ds/moz.build
@@ -33,16 +33,20 @@ if CONFIG['OS_ARCH'] == 'WINNT':
     ]
     EXPORTS += ['nsWindowsRegKey.h']
     SOURCES += [
         'nsWindowsRegKey.cpp'
     ]
 
 XPIDL_MODULE = 'xpcom_ds'
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 EXPORTS += [
     '!nsGkAtomConsts.h',
     '!nsGkAtomList.h',
     'nsArray.h',
     'nsArrayEnumerator.h',
     'nsArrayUtils.h',
     'nsAtom.h',
     'nsBaseHashtable.h',
new file mode 100644
--- /dev/null
+++ b/xpcom/io/components.conf
@@ -0,0 +1,38 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+Classes = [
+    {
+        'cid': '{f00152d0-b40b-11d3-8c9c-000064657374}',
+        'contract_ids': ['@mozilla.org/file/directory_service;1'],
+        'legacy_constructor': 'nsDirectoryService::Create',
+        'headers': ['nsDirectoryService.h'],
+    },
+    {
+        'cid': '{565e3a2c-1dd2-11b2-8da1-b4cef17e568d}',
+        'contract_ids': ['@mozilla.org/io/multiplex-input-stream;1'],
+        'legacy_constructor': 'nsMultiplexInputStreamConstructor',
+        'headers': ['nsMultiplexInputStream.h'],
+    },
+    {
+        'cid': '{e4a0ee4e-0775-457b-9118-b3ae97a7c758}',
+        'contract_ids': ['@mozilla.org/pipe;1'],
+        'legacy_constructor': 'nsPipeConstructor',
+        'headers': ['/xpcom/io/nsPipe.h'],
+    },
+    {
+        'cid': '{7225c040-a9bf-11d3-a197-0050041caf44}',
+        'contract_ids': ['@mozilla.org/scriptableinputstream;1'],
+        'legacy_constructor': 'nsScriptableInputStream::Create',
+        'headers': ['nsScriptableInputStream.h'],
+    },
+    {
+        'cid': '{0abb0835-5000-4790-af28-61b3ba17c295}',
+        'contract_ids': ['@mozilla.org/io/string-input-stream;1'],
+        'legacy_constructor': 'nsStringInputStreamConstructor',
+        'headers': ['/xpcom/build/XPCOMModule.h'],
+    },
+]
--- a/xpcom/io/moz.build
+++ b/xpcom/io/moz.build
@@ -56,16 +56,20 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
 else:
     EXPORTS += ['nsLocalFileUnix.h']
     SOURCES += [
         'nsLocalFileUnix.cpp',
     ]
 
 XPIDL_MODULE = 'xpcom_io'
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 EXPORTS += [
     'FileDescriptorFile.h',
     'nsAnonymousTemporaryFile.h',
     'nsAppDirectoryServiceDefs.h',
     'nsDirectoryService.h',
     'nsDirectoryServiceDefs.h',
     'nsDirectoryServiceUtils.h',
     'nsEscape.h',
new file mode 100644
--- /dev/null
+++ b/xpcom/threads/components.conf
@@ -0,0 +1,21 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+Classes = [
+    {
+        'cid': '{03d68f92-9513-4e25-9be9-7cb239874172}',
+        'contract_ids': ['@mozilla.org/process/environment;1'],
+        'legacy_constructor': 'nsEnvironment::Create',
+        'headers': ['/xpcom/threads/nsEnvironment.h'],
+    },
+    {
+        'cid': '{5ff24248-1dd2-11b2-8427-fbab44f29bc8}',
+        'contract_ids': ['@mozilla.org/timer;1'],
+        'legacy_constructor': 'nsTimer::XPCOMConstructor',
+        'headers': ['/xpcom/threads/nsTimerImpl.h'],
+        'processes': ProcessSelector.ALLOW_IN_GPU_AND_SOCKET_PROCESS,
+    },
+]
--- a/xpcom/threads/moz.build
+++ b/xpcom/threads/moz.build
@@ -17,16 +17,20 @@ XPIDL_SOURCES += [
     'nsIThreadInternal.idl',
     'nsIThreadManager.idl',
     'nsIThreadPool.idl',
     'nsITimer.idl',
 ]
 
 XPIDL_MODULE = 'xpcom_threads'
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 EXPORTS += [
     'MainThreadUtils.h',
     'nsICancelableRunnable.h',
     'nsIIdleRunnable.h',
     'nsILabelableRunnable.h',
     'nsMemoryPressure.h',
     'nsProcess.h',
     'nsProxyRelease.h',