Bug 892340 - Remove Off-Main-Thread XPCWrappedJS refcounting from (UDP)ServerSocketListenerProxy. r=mcmanus, a=bajaj
authorHector Zhao <bzhao@mozilla.com>
Thu, 11 Jul 2013 14:00:52 +0800
changeset 147908 300800156548b99860553b681eb5f7da7cda17c4
parent 147907 853f08e10baf35164e3d860f31997cb4e451e8f8
child 147909 c06bdff31cff0a791a0fe67a8236891eed582c5a
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus, bajaj
bugs892340
milestone24.0a2
Bug 892340 - Remove Off-Main-Thread XPCWrappedJS refcounting from (UDP)ServerSocketListenerProxy. r=mcmanus, a=bajaj
netwerk/base/src/nsUDPServerSocket.cpp
--- a/netwerk/base/src/nsUDPServerSocket.cpp
+++ b/netwerk/base/src/nsUDPServerSocket.cpp
@@ -508,63 +508,63 @@ nsUDPServerSocket::GetAddress(NetAddr *a
 }
 
 namespace {
 
 class ServerSocketListenerProxy MOZ_FINAL : public nsIUDPServerSocketListener
 {
 public:
   ServerSocketListenerProxy(nsIUDPServerSocketListener* aListener)
-    : mListener(aListener)
+    : mListener(new nsMainThreadPtrHolder<nsIUDPServerSocketListener>(aListener))
     , mTargetThread(do_GetCurrentThread())
   { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUDPSERVERSOCKETLISTENER
 
   class OnPacketReceivedRunnable : public nsRunnable
   {
   public:
-    OnPacketReceivedRunnable(nsIUDPServerSocketListener* aListener,
+    OnPacketReceivedRunnable(nsMainThreadPtrHolder<nsIUDPServerSocketListener>* aListener,
                      nsIUDPServerSocket* aServ,
                      nsIUDPMessage* aMessage)
       : mListener(aListener)
       , mServ(aServ)
       , mMessage(aMessage)
     { }
 
     NS_DECL_NSIRUNNABLE
 
   private:
-    nsCOMPtr<nsIUDPServerSocketListener> mListener;
+    nsMainThreadPtrHandle<nsIUDPServerSocketListener> mListener;
     nsCOMPtr<nsIUDPServerSocket> mServ;
     nsCOMPtr<nsIUDPMessage> mMessage;
   };
 
   class OnStopListeningRunnable : public nsRunnable
   {
   public:
-    OnStopListeningRunnable(nsIUDPServerSocketListener* aListener,
+    OnStopListeningRunnable(nsMainThreadPtrHolder<nsIUDPServerSocketListener>* aListener,
                             nsIUDPServerSocket* aServ,
                             nsresult aStatus)
       : mListener(aListener)
       , mServ(aServ)
       , mStatus(aStatus)
     { }
 
     NS_DECL_NSIRUNNABLE
 
   private:
-    nsCOMPtr<nsIUDPServerSocketListener> mListener;
+    nsMainThreadPtrHandle<nsIUDPServerSocketListener> mListener;
     nsCOMPtr<nsIUDPServerSocket> mServ;
     nsresult mStatus;
   };
 
 private:
-  nsCOMPtr<nsIUDPServerSocketListener> mListener;
+  nsMainThreadPtrHandle<nsIUDPServerSocketListener> mListener;
   nsCOMPtr<nsIEventTarget> mTargetThread;
 };
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(ServerSocketListenerProxy,
                               nsIUDPServerSocketListener)
 
 NS_IMETHODIMP
 ServerSocketListenerProxy::OnPacketReceived(nsIUDPServerSocket* aServ,