Bug 1550364 part 2. Use dom::UDPSocketChild, not nsIUDPSocketChild, in C++ code. r=baku
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 09 May 2019 06:55:05 +0000
changeset 535173 f9bdf7a91fbc79fc67c228bf0da8219f62465726
parent 535172 6225b9daa9d3e537a24e85a7f36dae882ff0d90a
child 535174 2e9edc96c3d22f6aab3cc9bb69125b134a381b82
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1550364
milestone68.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 1550364 part 2. Use dom::UDPSocketChild, not nsIUDPSocketChild, in C++ code. r=baku Differential Revision: https://phabricator.services.mozilla.com/D30445
dom/network/UDPSocket.cpp
dom/network/UDPSocket.h
media/mtransport/nr_socket_prsock.cpp
media/mtransport/nr_socket_prsock.h
--- a/dom/network/UDPSocket.cpp
+++ b/dom/network/UDPSocket.cpp
@@ -462,17 +462,17 @@ nsresult UDPSocket::InitLocal(const nsAS
 
   return NS_OK;
 }
 
 nsresult UDPSocket::InitRemote(const nsAString& aLocalAddress,
                                const uint16_t& aLocalPort) {
   nsresult rv;
 
-  nsCOMPtr<nsIUDPSocketChild> sock = new dom::UDPSocketChild();
+  RefPtr<UDPSocketChild> sock = new UDPSocketChild();
 
   mListenerProxy = new ListenerProxy(this);
 
   nsCOMPtr<nsIGlobalObject> obj = do_QueryInterface(GetOwner(), &rv);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
--- a/dom/network/UDPSocket.h
+++ b/dom/network/UDPSocket.h
@@ -28,16 +28,17 @@ extern LazyLogModule gUDPSocketLog;
 #define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, LogLevel::Debug, args)
 #define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, LogLevel::Debug)
 }  // namespace net
 
 namespace dom {
 
 struct UDPOptions;
 class StringOrBlobOrArrayBufferOrArrayBufferView;
+class UDPSocketChild;
 
 class UDPSocket final : public DOMEventTargetHelper,
                         public nsIUDPSocketListener,
                         public nsIUDPSocketInternal {
  public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(UDPSocket, DOMEventTargetHelper)
   NS_DECL_NSIUDPSOCKETLISTENER
@@ -146,17 +147,17 @@ class UDPSocket final : public DOMEventT
   Nullable<uint16_t> mRemotePort;
   bool mAddressReuse;
   bool mLoopback;
   SocketReadyState mReadyState;
   RefPtr<Promise> mOpened;
   RefPtr<Promise> mClosed;
 
   nsCOMPtr<nsIUDPSocket> mSocket;
-  nsCOMPtr<nsIUDPSocketChild> mSocketChild;
+  RefPtr<UDPSocketChild> mSocketChild;
   RefPtr<ListenerProxy> mListenerProxy;
 
   struct MulticastCommand {
     enum CommandType { Join, Leave };
 
     MulticastCommand(CommandType aCommand, const nsAString& aAddress)
         : mCommand(aCommand), mAddress(aAddress) {}
 
--- a/media/mtransport/nr_socket_prsock.cpp
+++ b/media/mtransport/nr_socket_prsock.cpp
@@ -1477,17 +1477,17 @@ int NrUdpSocketIpc::accept(nr_transport_
   return R_INTERNAL;
 }
 
 // IO thread executors
 void NrUdpSocketIpc::create_i(const nsACString& host, const uint16_t port) {
   ASSERT_ON_THREAD(io_thread_);
 
   uint32_t minBuffSize = 0;
-  nsCOMPtr<nsIUDPSocketChild> socketChild = new dom::UDPSocketChild();
+  RefPtr<dom::UDPSocketChild> socketChild = new dom::UDPSocketChild();
 
   // This can spin the event loop; don't do that with the monitor held
   socketChild->SetBackgroundSpinsEvents();
 
   ReentrantMonitorAutoEnter mon(monitor_);
   if (!socket_child_) {
     socket_child_ = socketChild;
     socket_child_->SetFilterName(
@@ -1577,20 +1577,20 @@ void NrUdpSocketIpc::close_i() {
 }
 
 #if defined(MOZILLA_INTERNAL_API)
 
 static void ReleaseIOThread_s() { sThread->ReleaseUse(); }
 
 // close(), but transfer the socket_child_ reference to die as well
 // static
-void NrUdpSocketIpc::destroy_i(nsIUDPSocketChild* aChild,
+void NrUdpSocketIpc::destroy_i(dom::UDPSocketChild* aChild,
                                nsCOMPtr<nsIEventTarget>& aStsThread) {
-  RefPtr<nsIUDPSocketChild> socket_child_ref =
-      already_AddRefed<nsIUDPSocketChild>(aChild);
+  RefPtr<dom::UDPSocketChild> socket_child_ref =
+      already_AddRefed<dom::UDPSocketChild>(aChild);
   if (socket_child_ref) {
     socket_child_ref->Close();
   }
 
   RUN_ON_THREAD(aStsThread, WrapRunnableNM(&ReleaseIOThread_s),
                 NS_DISPATCH_NORMAL);
 }
 #endif
--- a/media/mtransport/nr_socket_prsock.h
+++ b/media/mtransport/nr_socket_prsock.h
@@ -89,16 +89,20 @@ class TCPSocketChild;
 #endif
 
 namespace mozilla {
 
 namespace net {
 union NetAddr;
 }
 
+namespace dom {
+class UDPSocketChild;
+}  // namespace dom
+
 class NrSocketBase {
  public:
   NrSocketBase() : connect_invoked_(false), poll_flags_(0) {
     memset(cbs_, 0, sizeof(cbs_));
     memset(cb_args_, 0, sizeof(cb_args_));
     memset(&my_addr_, 0, sizeof(my_addr_));
   }
   virtual ~NrSocketBase() {}
@@ -272,29 +276,30 @@ class NrUdpSocketIpc : public NrSocketIp
   nsresult SetAddress();  // Set the local address from parent info.
 
   // Main or private thread executors of the NrSocketBase APIs
   void create_i(const nsACString& host, const uint16_t port);
   void connect_i(const nsACString& host, const uint16_t port);
   void sendto_i(const net::NetAddr& addr, nsAutoPtr<MediaPacket> buf);
   void close_i();
 #if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API)
-  static void destroy_i(nsIUDPSocketChild* aChild,
+  static void destroy_i(dom::UDPSocketChild* aChild,
                         nsCOMPtr<nsIEventTarget>& aStsThread);
 #endif
   // STS thread executor
   void recv_callback_s(RefPtr<nr_udp_message> msg);
 
   ReentrantMonitor monitor_;  // protects err_and state_
   bool err_;
   NrSocketIpcState state_;
 
   std::queue<RefPtr<nr_udp_message>> received_msgs_;
 
-  RefPtr<nsIUDPSocketChild> socket_child_;  // only accessed from the io_thread
+  // only accessed from the io_thread
+  RefPtr<dom::UDPSocketChild> socket_child_;
 };
 
 // The socket child holds onto one of these, which just passes callbacks
 // through and makes sure the ref to the NrSocketIpc is released on STS.
 class NrUdpSocketIpcProxy : public nsIUDPSocketInternal {
  public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIUDPSOCKETINTERNAL