Bug 1524688: Part 3 - Convert PeerConnection to static registration r=jib
☠☠ backed out by 3b1b94e39795 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Tue, 29 Jan 2019 17:44:56 -0800
changeset 458976 ee28258a5724
parent 458975 9201a7ea3c54
child 458977 6b3684e7d8f9
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)
reviewersjib
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 3 - Convert PeerConnection to static registration r=jib
browser/installer/package-manifest.in
dom/media/PeerConnection.js
dom/media/PeerConnection.jsm
dom/media/PeerConnection.manifest
dom/media/components.conf
dom/media/moz.build
mobile/android/installer/package-manifest.in
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -311,21 +311,16 @@
 @RESPATH@/components/ProcessSelector.manifest
 
 @RESPATH@/components/SlowScriptDebug.manifest
 @RESPATH@/components/SlowScriptDebug.js
 
 @RESPATH@/components/ClearDataService.manifest
 @RESPATH@/components/ClearDataService.js
 
-#ifdef MOZ_WEBRTC
-@RESPATH@/components/PeerConnection.js
-@RESPATH@/components/PeerConnection.manifest
-#endif
-
 ; Remote control protocol
 #ifdef ENABLE_MARIONETTE
 @RESPATH@/chrome/marionette@JAREXT@
 @RESPATH@/chrome/marionette.manifest
 @RESPATH@/components/marionette.manifest
 @RESPATH@/components/marionette.js
 @RESPATH@/defaults/pref/marionette.js
 #endif
rename from dom/media/PeerConnection.js
rename to dom/media/PeerConnection.jsm
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.jsm
@@ -1,29 +1,25 @@
 /* jshint moz:true, browser:true */
 /* 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, "PeerConnectionIdp",
   "resource://gre/modules/media/PeerConnectionIdp.jsm");
 ChromeUtils.defineModuleGetter(this, "convertToRTCStatsReport",
   "resource://gre/modules/media/RTCStatsReport.jsm");
-ChromeUtils.defineModuleGetter(this, "AppConstants",
-  "resource://gre/modules/AppConstants.jsm");
 
 const PC_CONTRACT = "@mozilla.org/dom/peerconnection;1";
 const PC_OBS_CONTRACT = "@mozilla.org/dom/peerconnectionobserver;1";
 const PC_ICE_CONTRACT = "@mozilla.org/dom/rtcicecandidate;1";
 const PC_SESSION_CONTRACT = "@mozilla.org/dom/rtcsessiondescription;1";
-const PC_MANAGER_CONTRACT = "@mozilla.org/dom/peerconnectionmanager;1";
 const PC_STATS_CONTRACT = "@mozilla.org/dom/rtcstatsreport;1";
 const PC_STATIC_CONTRACT = "@mozilla.org/dom/peerconnectionstatic;1";
 const PC_SENDER_CONTRACT = "@mozilla.org/dom/rtpsender;1";
 const PC_RECEIVER_CONTRACT = "@mozilla.org/dom/rtpreceiver;1";
 const PC_TRANSCEIVER_CONTRACT = "@mozilla.org/dom/rtptransceiver;1";
 const PC_COREQUEST_CONTRACT = "@mozilla.org/dom/createofferrequest;1";
 const PC_DTMF_SENDER_CONTRACT = "@mozilla.org/dom/rtcdtmfsender;1";
 
@@ -2380,22 +2376,21 @@ class CreateOfferRequest {
   }
 }
 setupPrototype(CreateOfferRequest, {
   classID: PC_COREQUEST_CID,
   contractID: PC_COREQUEST_CONTRACT,
   QueryInterface: ChromeUtils.generateQI([]),
 });
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
-  [GlobalPCList,
-   RTCDTMFSender,
-   RTCIceCandidate,
-   RTCSessionDescription,
-   RTCPeerConnection,
-   RTCPeerConnectionStatic,
-   RTCRtpReceiver,
-   RTCRtpSender,
-   RTCRtpTransceiver,
-   RTCStatsReport,
-   PeerConnectionObserver,
-   CreateOfferRequest]
-);
+var EXPORTED_SYMBOLS =
+  ["GlobalPCList",
+   "RTCDTMFSender",
+   "RTCIceCandidate",
+   "RTCSessionDescription",
+   "RTCPeerConnection",
+   "RTCPeerConnectionStatic",
+   "RTCRtpReceiver",
+   "RTCRtpSender",
+   "RTCRtpTransceiver",
+   "RTCStatsReport",
+   "PeerConnectionObserver",
+   "CreateOfferRequest"];
deleted file mode 100644
--- a/dom/media/PeerConnection.manifest
+++ /dev/null
@@ -1,23 +0,0 @@
-component {bdc2e533-b308-4708-ac8e-a8bfade6d851} PeerConnection.js
-component {d1748d4c-7f6a-4dc5-add6-d55b7678537e} PeerConnection.js
-component {02b9970c-433d-4cc2-923d-f7028ac66073} PeerConnection.js
-component {1775081b-b62d-4954-8ffe-a067bbf508a7} PeerConnection.js
-component {7293e901-2be3-4c02-b4bd-cbef6fc24f78} PeerConnection.js
-component {7fe6e18b-0da3-4056-bf3b-440ef3809e06} PeerConnection.js
-component {0fb47c47-a205-4583-a9fc-cbadf8c95880} PeerConnection.js
-component {4fff5d46-d827-4cd4-a970-8fd53977440e} PeerConnection.js
-component {d974b814-8fde-411c-8c45-b86791b81030} PeerConnection.js
-component {74b2122d-65a8-4824-aa9e-3d664cb75dc2} PeerConnection.js
-component {3610C242-654E-11E6-8EC0-6D1BE389A607} PeerConnection.js
-
-contract @mozilla.org/dom/peerconnection;1 {bdc2e533-b308-4708-ac8e-a8bfade6d851}
-contract @mozilla.org/dom/peerconnectionobserver;1 {d1748d4c-7f6a-4dc5-add6-d55b7678537e}
-contract @mozilla.org/dom/rtcdtmfsender;1 {3610C242-654E-11E6-8EC0-6D1BE389A607}
-contract @mozilla.org/dom/rtcicecandidate;1 {02b9970c-433d-4cc2-923d-f7028ac66073}
-contract @mozilla.org/dom/rtcsessiondescription;1 {1775081b-b62d-4954-8ffe-a067bbf508a7}
-contract @mozilla.org/dom/peerconnectionmanager;1 {7293e901-2be3-4c02-b4bd-cbef6fc24f78}
-contract @mozilla.org/dom/rtcstatsreport;1 {7fe6e18b-0da3-4056-bf3b-440ef3809e06}
-contract @mozilla.org/dom/peerconnectionstatic;1 {0fb47c47-a205-4583-a9fc-cbadf8c95880}
-contract @mozilla.org/dom/rtpsender;1 {4fff5d46-d827-4cd4-a970-8fd53977440e}
-contract @mozilla.org/dom/rtpreceiver;1 {d974b814-8fde-411c-8c45-b86791b81030}
-contract @mozilla.org/dom/createofferrequest;1 {74b2122d-65a8-4824-aa9e-3d664cb75dc2}
new file mode 100644
--- /dev/null
+++ b/dom/media/components.conf
@@ -0,0 +1,74 @@
+# -*- 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': '{bdc2e533-b308-4708-ac8e-a8bfade6d851}',
+        'contract_ids': ['@mozilla.org/dom/peerconnection;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'RTCPeerConnection',
+    },
+    {
+        'cid': '{d1748d4c-7f6a-4dc5-add6-d55b7678537e}',
+        'contract_ids': ['@mozilla.org/dom/peerconnectionobserver;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'PeerConnectionObserver',
+    },
+    {
+        'cid': '{3610C242-654E-11E6-8EC0-6D1BE389A607}',
+        'contract_ids': ['@mozilla.org/dom/rtcdtmfsender;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'RTCDTMFSender',
+    },
+    {
+        'cid': '{02b9970c-433d-4cc2-923d-f7028ac66073}',
+        'contract_ids': ['@mozilla.org/dom/rtcicecandidate;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'RTCIceCandidate',
+    },
+    {
+        'cid': '{1775081b-b62d-4954-8ffe-a067bbf508a7}',
+        'contract_ids': ['@mozilla.org/dom/rtcsessiondescription;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'RTCSessionDescription',
+    },
+    {
+        'cid': '{7293e901-2be3-4c02-b4bd-cbef6fc24f78}',
+        'contract_ids': ['@mozilla.org/dom/peerconnectionmanager;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'GlobalPCList',
+    },
+    {
+        'cid': '{7fe6e18b-0da3-4056-bf3b-440ef3809e06}',
+        'contract_ids': ['@mozilla.org/dom/rtcstatsreport;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'RTCStatsReport',
+    },
+    {
+        'cid': '{0fb47c47-a205-4583-a9fc-cbadf8c95880}',
+        'contract_ids': ['@mozilla.org/dom/peerconnectionstatic;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'RTCPeerConnectionStatic',
+    },
+    {
+        'cid': '{4fff5d46-d827-4cd4-a970-8fd53977440e}',
+        'contract_ids': ['@mozilla.org/dom/rtpsender;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'RTCRtpSender',
+    },
+    {
+        'cid': '{d974b814-8fde-411c-8c45-b86791b81030}',
+        'contract_ids': ['@mozilla.org/dom/rtpreceiver;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'RTCRtpReceiver',
+    },
+    {
+        'cid': '{74b2122d-65a8-4824-aa9e-3d664cb75dc2}',
+        'contract_ids': ['@mozilla.org/dom/createofferrequest;1'],
+        'jsm': 'resource://gre/modules/media/PeerConnection.jsm',
+        'constructor': 'CreateOfferRequest',
+    },
+]
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -302,20 +302,24 @@ SOURCES += [
     'DecoderTraits.cpp',
 ]
 
 # Some codec-related code uses multi-character constants, which GCC and clang
 # warn about. Suppress turning this warning into an error.
 if CONFIG['CC_TYPE'] in ('clang', 'clang-cl', 'gcc'):
   SOURCES['DecoderTraits.cpp'].flags += ['-Wno-error=multichar']
 
-EXTRA_COMPONENTS += [
-    'PeerConnection.js',
-    'PeerConnection.manifest',
-]
+if CONFIG['MOZ_WEBRTC']:
+    XPCOM_MANIFESTS += [
+        'components.conf',
+    ]
+
+    EXTRA_JS_MODULES.media += [
+        'PeerConnection.jsm',
+    ]
 
 EXTRA_JS_MODULES.media += [
     'IdpSandbox.jsm',
     'PeerConnectionIdp.jsm',
     'RTCStatsReport.jsm',
 ]
 
 LOCAL_INCLUDES += [
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -193,21 +193,16 @@
 @BINPATH@/components/TelemetryStartup.manifest
 #endif
 
 @BINPATH@/components/XULStore.js
 @BINPATH@/components/XULStore.manifest
 @BINPATH@/components/htmlMenuBuilder.js
 @BINPATH@/components/htmlMenuBuilder.manifest
 
-#ifdef MOZ_WEBRTC
-@BINPATH@/components/PeerConnection.js
-@BINPATH@/components/PeerConnection.manifest
-#endif
-
 @BINPATH@/components/CaptivePortalDetectComponents.manifest
 @BINPATH@/components/captivedetect.js
 
 #if defined(ENABLE_TESTS) && defined(MOZ_DEBUG)
 @BINPATH@/components/TestInterfaceJS.js
 @BINPATH@/components/TestInterfaceJS.manifest
 @BINPATH@/components/TestInterfaceJSMaplike.js
 #endif