Bug 1524688: Part 7 - Convert process singletons to static registration r=mconley
☠☠ backed out by 3b1b94e39795 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Tue, 29 Jan 2019 18:32:37 -0800
changeset 458980 5ce5986068f0
parent 458979 ab64ed7388ae
child 458981 fdc6c4ed241a
push id111909
push usermaglione.k@gmail.com
push dateThu, 14 Feb 2019 02:30:40 +0000
treeherdermozilla-inbound@81dc12cc9257 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1524688
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 1524688: Part 7 - Convert process singletons to static registration r=mconley
browser/base/content/test/performance/browser_startup.js
browser/base/content/test/performance/browser_startup_content.js
browser/installer/package-manifest.in
mobile/android/installer/package-manifest.in
toolkit/components/processsingleton/ContentProcessSingleton.js
toolkit/components/processsingleton/ContentProcessSingleton.jsm
toolkit/components/processsingleton/MainProcessSingleton.js
toolkit/components/processsingleton/MainProcessSingleton.jsm
toolkit/components/processsingleton/ProcessSingleton.manifest
toolkit/components/processsingleton/components.conf
toolkit/components/processsingleton/moz.build
--- a/browser/base/content/test/performance/browser_startup.js
+++ b/browser/base/content/test/performance/browser_startup.js
@@ -22,27 +22,26 @@ const kDumpAllStacks = false;
 const startupPhases = {
   // For app-startup, we have a whitelist of acceptable JS files.
   // Anything loaded during app-startup must have a compelling reason
   // to run before we have even selected the user profile.
   // Consider loading your code after first paint instead,
   // eg. from BrowserGlue.jsm' _onFirstWindowLoaded method).
   "before profile selection": {whitelist: {
     components: new Set([
-      "MainProcessSingleton.js",
-
       // Bugs to fix: The following components shouldn't be initialized that early.
       "PushComponents.js", // bug 1369436
     ]),
     modules: new Set([
       "resource:///modules/BrowserGlue.jsm",
       "resource://gre/modules/AppConstants.jsm",
       "resource://gre/modules/ActorManagerParent.jsm",
       "resource://gre/modules/CustomElementsListener.jsm",
       "resource://gre/modules/ExtensionUtils.jsm",
+      "resource://gre/modules/MainProcessSingleton.jsm",
       "resource://gre/modules/XPCOMUtils.jsm",
       "resource://gre/modules/Services.jsm",
     ]),
   }},
 
   // For the following phases of startup we have only a black list for now
 
   // We are at this phase after creating the first browser window (ie. after final-ui-startup).
--- a/browser/base/content/test/performance/browser_startup_content.js
+++ b/browser/base/content/test/performance/browser_startup_content.js
@@ -13,24 +13,23 @@
  */
 
 "use strict";
 
 /* Set this to true only for debugging purpose; it makes the output noisy. */
 const kDumpAllStacks = false;
 
 const whitelist = {
-  components: new Set([
-    "ContentProcessSingleton.js",
-  ]),
   modules: new Set([
     "chrome://mochikit/content/ShutdownLeaksCollector.jsm",
     "resource://specialpowers/specialpowers.js",
     "resource://specialpowers/specialpowersAPI.js",
 
+    "resource://gre/modules/ContentProcessSingleton.jsm",
+
     // General utilities
     "resource://gre/modules/AppConstants.jsm",
     "resource://gre/modules/AsyncShutdown.jsm",
     "resource://gre/modules/DeferredTask.jsm",
     "resource://gre/modules/PromiseUtils.jsm",
     "resource://gre/modules/Services.jsm", // bug 1464542
     "resource://gre/modules/Timer.jsm",
     "resource://gre/modules/XPCOMUtils.jsm",
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -226,18 +226,16 @@
 #ifdef MOZ_UPDATER
 @RESPATH@/components/nsUpdateService.manifest
 #endif
 @RESPATH@/components/nsUpdateTimerManager.manifest
 @RESPATH@/components/nsUpdateTimerManager.js
 @RESPATH@/components/utils.manifest
 @RESPATH@/components/simpleServices.js
 @RESPATH@/components/ProcessSingleton.manifest
-@RESPATH@/components/MainProcessSingleton.js
-@RESPATH@/components/ContentProcessSingleton.js
 @RESPATH@/components/nsURLFormatter.manifest
 @RESPATH@/components/nsURLFormatter.js
 @RESPATH@/components/PageThumbsStorageService.js
 @RESPATH@/components/mozProtocolHandler.js
 @RESPATH@/components/mozProtocolHandler.manifest
 @RESPATH@/components/nsDefaultCLH.manifest
 @RESPATH@/components/nsDefaultCLH.js
 @RESPATH@/components/ContentPrefService2.manifest
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -161,18 +161,16 @@
 
 @BINPATH@/components/ClearDataService.manifest
 @BINPATH@/components/ClearDataService.js
 
 @BINPATH@/components/nsUpdateTimerManager.manifest
 @BINPATH@/components/nsUpdateTimerManager.js
 
 @BINPATH@/components/ProcessSingleton.manifest
-@BINPATH@/components/MainProcessSingleton.js
-@BINPATH@/components/ContentProcessSingleton.js
 @BINPATH@/components/nsURLFormatter.manifest
 @BINPATH@/components/nsURLFormatter.js
 @BINPATH@/components/ContentPrefService2.manifest
 @BINPATH@/components/ContentPrefService2.js
 @BINPATH@/components/HandlerService.manifest
 @BINPATH@/components/HandlerService.js
 @BINPATH@/components/nsWebHandlerApp.manifest
 @BINPATH@/components/nsWebHandlerApp.js
rename from toolkit/components/processsingleton/ContentProcessSingleton.js
rename to toolkit/components/processsingleton/ContentProcessSingleton.jsm
--- a/toolkit/components/processsingleton/ContentProcessSingleton.js
+++ b/toolkit/components/processsingleton/ContentProcessSingleton.jsm
@@ -34,9 +34,9 @@ ContentProcessSingleton.prototype = {
     }
     case "xpcom-shutdown":
       Services.obs.removeObserver(this, "xpcom-shutdown");
       break;
     }
   },
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentProcessSingleton]);
+var EXPORTED_SYMBOLS = ["ContentProcessSingleton"];
rename from toolkit/components/processsingleton/MainProcessSingleton.js
rename to toolkit/components/processsingleton/MainProcessSingleton.jsm
--- a/toolkit/components/processsingleton/MainProcessSingleton.js
+++ b/toolkit/components/processsingleton/MainProcessSingleton.jsm
@@ -1,16 +1,15 @@
 /* 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/. */
 
 "use strict";
 
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 ChromeUtils.defineModuleGetter(this, "NetUtil",
                                "resource://gre/modules/NetUtil.jsm");
 
 function MainProcessSingleton() {}
 MainProcessSingleton.prototype = {
   classID: Components.ID("{0636a680-45cb-11e4-916c-0800200c9a66}"),
   QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver,
@@ -70,9 +69,9 @@ MainProcessSingleton.prototype = {
 
     case "xpcom-shutdown":
       Services.mm.removeMessageListener("Search:AddEngine", this.addSearchEngine);
       break;
     }
   },
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MainProcessSingleton]);
+var EXPORTED_SYMBOLS = ["MainProcessSingleton"];
--- a/toolkit/components/processsingleton/ProcessSingleton.manifest
+++ b/toolkit/components/processsingleton/ProcessSingleton.manifest
@@ -1,7 +1,2 @@
-component {0636a680-45cb-11e4-916c-0800200c9a66} MainProcessSingleton.js process=main
-contract @mozilla.org/main-process-singleton;1 {0636a680-45cb-11e4-916c-0800200c9a66} process=main
 category app-startup MainProcessSingleton service,@mozilla.org/main-process-singleton;1 process=main
-
-component {ca2a8470-45c7-11e4-916c-0800200c9a66} ContentProcessSingleton.js process=content
-contract @mozilla.org/content-process-singleton;1 {ca2a8470-45c7-11e4-916c-0800200c9a66} process=content
 category app-startup ContentProcessSingleton service,@mozilla.org/content-process-singleton;1 process=content
new file mode 100644
--- /dev/null
+++ b/toolkit/components/processsingleton/components.conf
@@ -0,0 +1,22 @@
+# -*- 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': '{0636a680-45cb-11e4-916c-0800200c9a66}',
+        'contract_ids': ['@mozilla.org/main-process-singleton;1'],
+        'jsm': 'resource://gre/modules/MainProcessSingleton.jsm',
+        'constructor': 'MainProcessSingleton',
+        'processes': ProcessSelector.MAIN_PROCESS_ONLY,
+    },
+    {
+        'cid': '{ca2a8470-45c7-11e4-916c-0800200c9a66}',
+        'contract_ids': ['@mozilla.org/content-process-singleton;1'],
+        'jsm': 'resource://gre/modules/ContentProcessSingleton.jsm',
+        'constructor': 'ContentProcessSingleton',
+        'processes': ProcessSelector.CONTENT_PROCESS_ONLY,
+    },
+]
--- a/toolkit/components/processsingleton/moz.build
+++ b/toolkit/components/processsingleton/moz.build
@@ -3,16 +3,20 @@
 # 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/.
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'General')
 
 EXTRA_COMPONENTS += [
-    'ContentProcessSingleton.js',
-    'MainProcessSingleton.js',
     'ProcessSingleton.manifest',
 ]
 
 EXTRA_JS_MODULES += [
+    'ContentProcessSingleton.jsm',
     'CustomElementsListener.jsm',
+    'MainProcessSingleton.jsm',
 ]
+
+XPCOM_MANIFESTS += [
+    'components.conf',
+]