Bug 1524687: Part 6 - Convert intl modules to static registration. r=zbraniecki
☠☠ backed out by 3b1b94e39795 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Thu, 24 Jan 2019 15:58:31 -0800
changeset 458966 f4ee175bc5bd
parent 458965 191afe83da2e
child 458967 92d9e927deec
push id111908
push usermaglione.k@gmail.com
push dateThu, 14 Feb 2019 02:29:45 +0000
treeherdermozilla-inbound@625f71135038 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszbraniecki
bugs1524687
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 1524687: Part 6 - Convert intl modules to static registration. r=zbraniecki Differential Revision: https://phabricator.services.mozilla.com/D18401
intl/build/components.conf
intl/build/moz.build
intl/build/nsI18nModule.cpp
intl/locale/components.conf
intl/locale/moz.build
intl/uconv/components.conf
intl/uconv/moz.build
intl/uconv/nsUConvModule.cpp
new file mode 100644
--- /dev/null
+++ b/intl/build/components.conf
@@ -0,0 +1,15 @@
+# -*- 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': '{d85a17c1-aa7c-11d2-9b8c-00805f8a16d9}',
+        'contract_ids': ['@mozilla.org/intl/stringbundle;1'],
+        'type': 'nsStringBundleService',
+        'headers': ['/intl/strres/nsStringBundleService.h'],
+        'init_method': 'Init',
+    },
+]
--- a/intl/build/moz.build
+++ b/intl/build/moz.build
@@ -1,16 +1,16 @@
 # -*- 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/.
 
-SOURCES += [
-    'nsI18nModule.cpp',
+XPCOM_MANIFESTS += [
+    'components.conf',
 ]
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '../locale',
     '../lwbrk',
     '../strres',
     '../uconv',
deleted file mode 100644
--- a/intl/build/nsI18nModule.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; 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 "mozilla/ModuleUtils.h"
-
-// string bundles (intl)
-#include "nsStringBundleService.h"
-
-// locale
-#include "nsLocaleConstructors.h"
-
-// uconv
-
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleService, Init)
-
-NS_DEFINE_NAMED_CID(MOZ_LOCALESERVICE_CID);
-NS_DEFINE_NAMED_CID(MOZ_OSPREFERENCES_CID);
-NS_DEFINE_NAMED_CID(NS_STRINGBUNDLESERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_COLLATIONFACTORY_CID);
-
-static const mozilla::Module::CIDEntry kIntlCIDs[] = {
-    {&kMOZ_LOCALESERVICE_CID, false, nullptr,
-     mozilla::intl::LocaleServiceConstructor},
-    {&kMOZ_OSPREFERENCES_CID, false, nullptr,
-     mozilla::intl::OSPreferencesConstructor},
-    {&kNS_STRINGBUNDLESERVICE_CID, false, nullptr,
-     nsStringBundleServiceConstructor},
-    {&kNS_COLLATIONFACTORY_CID, false, nullptr, nsCollationFactoryConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kIntlContracts[] = {
-    {MOZ_LOCALESERVICE_CONTRACTID, &kMOZ_LOCALESERVICE_CID},
-    {MOZ_OSPREFERENCES_CONTRACTID, &kMOZ_OSPREFERENCES_CID},
-    {NS_STRINGBUNDLE_CONTRACTID, &kNS_STRINGBUNDLESERVICE_CID},
-    {NS_COLLATIONFACTORY_CONTRACTID, &kNS_COLLATIONFACTORY_CID},
-    {nullptr}};
-
-static const mozilla::Module kIntlModule = {mozilla::Module::kVersion,
-                                            kIntlCIDs,
-                                            kIntlContracts,
-                                            nullptr,
-                                            nullptr,
-                                            nullptr,
-                                            nullptr};
-
-NSMODULE_DEFN(nsI18nModule) = &kIntlModule;
new file mode 100644
--- /dev/null
+++ b/intl/locale/components.conf
@@ -0,0 +1,30 @@
+# -*- 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': '{92735ff4-6384-4ad6-8508-757010e149ee}',
+        'contract_ids': ['@mozilla.org/intl/localeservice;1'],
+        'singleton': True,
+        'type': 'mozilla::intl::LocaleService',
+        'headers': ['mozilla/intl/LocaleService.h'],
+        'constructor': 'mozilla::intl::LocaleService::GetInstanceAddRefed',
+    },
+    {
+        'cid': '{65944815-e9ae-48bd-a2bf-f1108720950c}',
+        'contract_ids': ['@mozilla.org/intl/ospreferences;1'],
+        'singleton': True,
+        'type': 'mozilla::intl::OSPreferences',
+        'headers': ['mozilla/intl/OSPreferences.h'],
+        'constructor': 'mozilla::intl::OSPreferences::GetInstanceAddRefed',
+    },
+    {
+        'cid': '{a1b72850-a999-11d2-9119-006008a6edf6}',
+        'contract_ids': ['@mozilla.org/intl/collation-factory;1'],
+        'type': 'nsCollationFactory',
+        'headers': ['/intl/locale/nsCollationFactory.h'],
+    },
+]
--- a/intl/locale/moz.build
+++ b/intl/locale/moz.build
@@ -48,16 +48,20 @@ UNIFIED_SOURCES += [
     'nsUConvPropertySearch.cpp',
     'OSPreferences.cpp',
 ]
 
 EXTRA_JS_MODULES += [
     'PluralForm.jsm',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/intl/uconv',
 ]
 
 RESOURCE_FILES += [
     'language.properties',
new file mode 100644
--- /dev/null
+++ b/intl/uconv/components.conf
@@ -0,0 +1,32 @@
+# -*- 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': '{2bc2ad62-ad5d-4b7b-a9db-f74ae203c527}',
+        'contract_ids': ['@mozilla.org/intl/converter-input-stream;1'],
+        'type': 'nsConverterInputStream',
+        'headers': ['nsConverterInputStream.h'],
+    },
+    {
+        'cid': '{ff8780a5-bbb1-4bc5-8ee7-057e7bc5c925}',
+        'contract_ids': ['@mozilla.org/intl/converter-output-stream;1'],
+        'type': 'nsConverterOutputStream',
+        'headers': ['/intl/uconv/nsConverterOutputStream.h'],
+    },
+    {
+        'cid': '{0a698c44-3bff-11d4-9649-00c0ca135b4e}',
+        'contract_ids': ['@mozilla.org/intl/scriptableunicodeconverter'],
+        'type': 'nsScriptableUnicodeConverter',
+        'headers': ['/intl/uconv/nsScriptableUConv.h'],
+    },
+    {
+        'cid': '{8b042e22-6f87-11d3-b3c8-00805f8a6670}',
+        'contract_ids': ['@mozilla.org/intl/texttosuburi;1'],
+        'type': 'nsTextToSubURI',
+        'headers': ['/intl/uconv/nsTextToSubURI.h'],
+    },
+]
--- a/intl/uconv/moz.build
+++ b/intl/uconv/moz.build
@@ -17,15 +17,18 @@ EXPORTS += [
     'nsConverterInputStream.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsConverterInputStream.cpp',
     'nsConverterOutputStream.cpp',
     'nsScriptableUConv.cpp',
     'nsTextToSubURI.cpp',
-    'nsUConvModule.cpp',
+]
+
+XPCOM_MANIFESTS += [
+    'components.conf',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
deleted file mode 100644
--- a/intl/uconv/nsUConvModule.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- 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 "mozilla/ModuleUtils.h"
-
-#include "nsTextToSubURI.h"
-#include "nsConverterInputStream.h"
-#include "nsConverterOutputStream.h"
-#include "nsScriptableUConv.h"
-#include "nsIOutputStream.h"
-#include "nsITextToSubURI.h"
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextToSubURI)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsConverterInputStream)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsConverterOutputStream)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableUnicodeConverter)
-
-NS_DEFINE_NAMED_CID(NS_TEXTTOSUBURI_CID);
-NS_DEFINE_NAMED_CID(NS_CONVERTERINPUTSTREAM_CID);
-NS_DEFINE_NAMED_CID(NS_CONVERTEROUTPUTSTREAM_CID);
-NS_DEFINE_NAMED_CID(NS_ISCRIPTABLEUNICODECONVERTER_CID);
-
-static const mozilla::Module::CIDEntry kUConvCIDs[] = {
-    {&kNS_TEXTTOSUBURI_CID, false, nullptr, nsTextToSubURIConstructor},
-    {&kNS_CONVERTERINPUTSTREAM_CID, false, nullptr,
-     nsConverterInputStreamConstructor},
-    {&kNS_CONVERTEROUTPUTSTREAM_CID, false, nullptr,
-     nsConverterOutputStreamConstructor},
-    {&kNS_ISCRIPTABLEUNICODECONVERTER_CID, false, nullptr,
-     nsScriptableUnicodeConverterConstructor},
-    {nullptr},
-};
-
-static const mozilla::Module::ContractIDEntry kUConvContracts[] = {
-    {NS_ITEXTTOSUBURI_CONTRACTID, &kNS_TEXTTOSUBURI_CID},
-    {NS_CONVERTERINPUTSTREAM_CONTRACTID, &kNS_CONVERTERINPUTSTREAM_CID},
-    {"@mozilla.org/intl/converter-output-stream;1",
-     &kNS_CONVERTEROUTPUTSTREAM_CID},
-    {NS_ISCRIPTABLEUNICODECONVERTER_CONTRACTID,
-     &kNS_ISCRIPTABLEUNICODECONVERTER_CID},
-    {nullptr}};
-
-static const mozilla::Module kUConvModule = {
-    mozilla::Module::kVersion,
-    kUConvCIDs,
-    kUConvContracts,
-};
-
-NSMODULE_DEFN(nsUConvModule) = &kUConvModule;