Bug 1524687: Part 7 - Convert media bridge module to static registration. r=jesup
☠☠ backed out by 3b1b94e39795 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Thu, 24 Jan 2019 16:07:39 -0800
changeset 519927 92d9e927deec9628ddbde16238debccc10b93b3b
parent 519926 f4ee175bc5bda170021c09456819bc9daeea6408
child 519928 b9862758b98ccb95e90901258bcea159784c7483
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
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 7 - Convert media bridge module to static registration. r=jesup Differential Revision: https://phabricator.services.mozilla.com/D18402
dom/media/bridge/MediaModule.cpp
dom/media/bridge/components.conf
dom/media/bridge/moz.build
--- a/dom/media/bridge/MediaModule.cpp
+++ b/dom/media/bridge/MediaModule.cpp
@@ -1,59 +1,16 @@
 /* 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 "nsIClassInfoImpl.h"
+#include "mozilla/Components.h"
 
 #ifdef MOZ_WEBRTC
-
 #  include "PeerConnectionImpl.h"
 
-#  define PEERCONNECTION_CID                           \
-    {                                                  \
-      0xb93af7a1, 0x3411, 0x44a8, {                    \
-        0xbd, 0x0a, 0x8a, 0xf3, 0xdd, 0xe4, 0xd8, 0xd8 \
-      }                                                \
-    }
-
-#  define PEERCONNECTION_CONTRACTID "@mozilla.org/peerconnection;1"
-
-#  include "stun_socket_filter.h"
-
-NS_DEFINE_NAMED_CID(NS_STUN_UDP_SOCKET_FILTER_HANDLER_CID)
-NS_DEFINE_NAMED_CID(NS_STUN_TCP_SOCKET_FILTER_HANDLER_CID)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsStunUDPSocketFilterHandler)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsStunTCPSocketFilterHandler)
-
-namespace mozilla {
-// Factory defined in mozilla::, defines mozilla::PeerConnectionImplConstructor
-NS_GENERIC_FACTORY_CONSTRUCTOR(PeerConnectionImpl)
-}  // namespace mozilla
+using namespace mozilla;
 
-// Defines kPEERCONNECTION_CID
-NS_DEFINE_NAMED_CID(PEERCONNECTION_CID);
-
-static const mozilla::Module::CIDEntry kCIDs[] = {
-    {&kPEERCONNECTION_CID, false, nullptr,
-     mozilla::PeerConnectionImplConstructor},
-    {&kNS_STUN_UDP_SOCKET_FILTER_HANDLER_CID, false, nullptr,
-     nsStunUDPSocketFilterHandlerConstructor},
-    {&kNS_STUN_TCP_SOCKET_FILTER_HANDLER_CID, false, nullptr,
-     nsStunTCPSocketFilterHandlerConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kContracts[] = {
-    {PEERCONNECTION_CONTRACTID, &kPEERCONNECTION_CID},
-    {NS_STUN_UDP_SOCKET_FILTER_HANDLER_CONTRACTID,
-     &kNS_STUN_UDP_SOCKET_FILTER_HANDLER_CID},
-    {NS_STUN_TCP_SOCKET_FILTER_HANDLER_CONTRACTID,
-     &kNS_STUN_TCP_SOCKET_FILTER_HANDLER_CID},
-    {nullptr}};
-
-static const mozilla::Module kModule = {mozilla::Module::kVersion, kCIDs,
-                                        kContracts};
-
-NSMODULE_DEFN(peerconnection) = &kModule;
+NS_IMPL_COMPONENT_FACTORY(mozilla::PeerConnectionImpl) {
+  return do_AddRef(new PeerConnectionImpl()).downcast<nsISupports>();
+}
 
 #endif
new file mode 100644
--- /dev/null
+++ b/dom/media/bridge/components.conf
@@ -0,0 +1,25 @@
+# -*- 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': '{b93af7a1-3411-44a8-bd0a-8af3dde4d8d8}',
+        'contract_ids': ['@mozilla.org/peerconnection;1'],
+        'type': 'mozilla::PeerConnectionImpl',
+    },
+    {
+        'cid': '{9fea635a-2fc2-4d08-9721-d238d3f52f92}',
+        'contract_ids': ['@mozilla.org/network/tcp-filter-handler;1?name=stun'],
+        'type': 'nsStunTCPSocketFilterHandler',
+        'headers': ['mtransport/stun_socket_filter.h'],
+    },
+    {
+        'cid': '{3e43ee93-829e-4ea6-a34e-62d9e4c9f993}',
+        'contract_ids': ['@mozilla.org/network/udp-filter-handler;1?name=stun'],
+        'type': 'nsStunUDPSocketFilterHandler',
+        'headers': ['mtransport/stun_socket_filter.h'],
+    },
+]
--- a/dom/media/bridge/moz.build
+++ b/dom/media/bridge/moz.build
@@ -21,12 +21,17 @@ LOCAL_INCLUDES += [
     '/media/webrtc/',
     '/media/webrtc/signaling/src/common/time_profiling',
     '/media/webrtc/signaling/src/media-conduit',
     '/media/webrtc/signaling/src/mediapipeline',
     '/media/webrtc/signaling/src/peerconnection',
     '/media/webrtc/trunk/',
 ]
 
+if CONFIG['MOZ_WEBRTC']:
+    XPCOM_MANIFESTS += [
+        'components.conf',
+    ]
+
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']