Bug 884061 - Part 3o: Use NS_DECL_THREADSAFE_ISUPPORTS in media/, r=abr
authorJoshua Cranmer <Pidgeot18@gmail.com>
Thu, 18 Jul 2013 21:23:32 -0500
changeset 151898 f4087583ffc1439115ec1d11dbd44343dfd72a4b
parent 151897 7df0367427d3bb2d0e9912fbbd335bbede179be4
child 151899 96104885ff185b6a60b4001752da605b6826cec9
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersabr
bugs884061
milestone25.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 884061 - Part 3o: Use NS_DECL_THREADSAFE_ISUPPORTS in media/, r=abr
media/mtransport/nr_socket_prsock.cpp
media/mtransport/nr_socket_prsock.h
media/mtransport/nr_timer.cpp
media/mtransport/nriceresolver.cpp
media/mtransport/nriceresolver.h
media/mtransport/test/sctp_unittest.cpp
media/mtransport/transportlayerloopback.cpp
media/mtransport/transportlayerloopback.h
media/mtransport/transportlayerprsock.cpp
media/mtransport/transportlayerprsock.h
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
media/webrtc/signaling/test/FakeMediaStreams.h
media/webrtc/signaling/test/FakeMediaStreamsImpl.h
media/webrtc/signaling/test/signaling_unittests.cpp
--- a/media/mtransport/nr_socket_prsock.cpp
+++ b/media/mtransport/nr_socket_prsock.cpp
@@ -111,17 +111,17 @@ extern "C" {
 #include "nr_socket.h"
 #include "nr_socket_local.h"
 }
 #include "nr_socket_prsock.h"
 
 // Implement the nsISupports ref counting
 namespace mozilla {
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(NrSocket)
+NS_IMPL_ISUPPORTS0(NrSocket)
 
 
 // The nsASocket callbacks
 void NrSocket::OnSocketReady(PRFileDesc *fd, int16_t outflags) {
   if (outflags & PR_POLL_READ)
     fire_callback(NR_ASYNC_WAIT_READ);
   if (outflags & PR_POLL_WRITE)
     fire_callback(NR_ASYNC_WAIT_WRITE);
--- a/media/mtransport/nr_socket_prsock.h
+++ b/media/mtransport/nr_socket_prsock.h
@@ -79,17 +79,17 @@ public:
   // Implement nsASocket
   virtual void OnSocketReady(PRFileDesc *fd, int16_t outflags);
   virtual void OnSocketDetached(PRFileDesc *fd);
   virtual void IsLocal(bool *aIsLocal);
   virtual uint64_t ByteCountSent() { return 0; }
   virtual uint64_t ByteCountReceived() { return 0; }
 
   // nsISupports methods
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // Implementations of the async_event APIs
   int async_wait(int how, NR_async_cb cb, void *cb_arg,
                  char *function, int line);
   int cancel(int how);
 
 
   // Implementations of the nr_socket APIs
--- a/media/mtransport/nr_timer.cpp
+++ b/media/mtransport/nr_timer.cpp
@@ -65,17 +65,18 @@ extern "C" {
 }
 
 
 namespace mozilla {
 
 class nrappkitTimerCallback : public nsITimerCallback
 {
 public:
-  NS_DECL_ISUPPORTS
+  // We're going to release ourself in the callback, so we need to be threadsafe
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSITIMERCALLBACK
 
   nrappkitTimerCallback(NR_async_cb cb, void *cb_arg,
                         const char *function, int line)
     : cb_(cb), cb_arg_(cb_arg), function_(function), line_(line) {
   }
 
 private:
@@ -84,18 +85,17 @@ private:
 protected:
   /* additional members */
   NR_async_cb cb_;
   void *cb_arg_;
   std::string function_;
   int line_;
 };
 
-// We're going to release ourself in the callback, so we need to be threadsafe
-NS_IMPL_THREADSAFE_ISUPPORTS1(nrappkitTimerCallback, nsITimerCallback)
+NS_IMPL_ISUPPORTS1(nrappkitTimerCallback, nsITimerCallback)
 
 NS_IMETHODIMP nrappkitTimerCallback::Notify(nsITimer *timer) {
   r_log(LOG_GENERIC, LOG_DEBUG, "Timer callback fired (set in %s:%d)",
         function_.c_str(), line_);
 
   cb_(0, 0, cb_arg_);
 
   // Allow the timer to go away.
--- a/media/mtransport/nriceresolver.cpp
+++ b/media/mtransport/nriceresolver.cpp
@@ -207,10 +207,10 @@ int NrIceResolver::cancel(void *obj, voi
 
 int NrIceResolver::PendingResolution::cancel() {
   request_->Cancel (NS_ERROR_ABORT);
   canceled_ = true; // in case OnLookupComplete is already on event queue.
   Release();
   return 0;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(NrIceResolver::PendingResolution, nsIDNSListener);
+NS_IMPL_ISUPPORTS1(NrIceResolver::PendingResolution, nsIDNSListener);
 }  // End of namespace mozilla
--- a/media/mtransport/nriceresolver.h
+++ b/media/mtransport/nriceresolver.h
@@ -93,17 +93,17 @@ class NrIceResolver
         port_(port),
         cb_(cb), cb_arg_(cb_arg),
         canceled_ (false) {}
     virtual ~PendingResolution(){};
     NS_IMETHOD OnLookupComplete(nsICancelable *request, nsIDNSRecord *record,
                                 nsresult status);
     int cancel();
     nsCOMPtr<nsICancelable> request_;
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
    private:
     nsCOMPtr<nsIEventTarget> thread_;
     uint16_t port_;
     int (*cb_)(void *cb_arg, nr_transport_addr *addr);
     void *cb_arg_;
     bool canceled_;
   };
--- a/media/mtransport/test/sctp_unittest.cpp
+++ b/media/mtransport/test/sctp_unittest.cpp
@@ -44,25 +44,25 @@ class TransportTestPeer;
 
 class SendPeriodic : public nsITimerCallback {
  public:
   SendPeriodic(TransportTestPeer *peer, int to_send) :
       peer_(peer),
       to_send_(to_send) {}
   virtual ~SendPeriodic() {}
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSITIMERCALLBACK
 
  protected:
   TransportTestPeer *peer_;
   int to_send_;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(SendPeriodic, nsITimerCallback)
+NS_IMPL_ISUPPORTS1(SendPeriodic, nsITimerCallback)
 
 
 class TransportTestPeer : public sigslot::has_slots<> {
  public:
   TransportTestPeer(std::string name, int local_port, int remote_port)
       : name_(name), connected_(false),
         sent_(0), received_(0),
         flow_(new TransportFlow()),
--- a/media/mtransport/transportlayerloopback.cpp
+++ b/media/mtransport/transportlayerloopback.cpp
@@ -103,18 +103,17 @@ void TransportLayerLoopback::DeliverPack
     MOZ_MTLOG(ML_DEBUG, LAYER_INFO << " Delivering packet of length " <<
          packet->len());
     SignalPacketReceived(this, packet->data(), packet->len());
 
     delete packet;
   }
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(TransportLayerLoopback::Deliverer,
-                              nsITimerCallback)
+NS_IMPL_ISUPPORTS1(TransportLayerLoopback::Deliverer, nsITimerCallback)
 
 NS_IMETHODIMP TransportLayerLoopback::Deliverer::Notify(nsITimer *timer) {
   if (!layer_)
     return NS_OK;
 
   layer_->DeliverPackets();
 
   return NS_OK;
--- a/media/mtransport/transportlayerloopback.h
+++ b/media/mtransport/transportlayerloopback.h
@@ -110,17 +110,17 @@ class TransportLayerLoopback : public Tr
     Deliverer(TransportLayerLoopback *layer) :
         layer_(layer) {}
     virtual ~Deliverer() {
     }
     void Detach() {
       layer_ = nullptr;
     }
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSITIMERCALLBACK
 
  private:
     DISALLOW_COPY_ASSIGN(Deliverer);
 
     TransportLayerLoopback *layer_;
   };
 
--- a/media/mtransport/transportlayerprsock.cpp
+++ b/media/mtransport/transportlayerprsock.cpp
@@ -107,10 +107,10 @@ void TransportLayerPrsock::OnSocketReady
 
     if (err != PR_WOULD_BLOCK_ERROR) {
       MOZ_MTLOG(ML_DEBUG, LAYER_INFO << "Read error; channel closed");
       SetState(TS_ERROR);
     }
   }
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(TransportLayerPrsock::SocketHandler)
+NS_IMPL_ISUPPORTS0(TransportLayerPrsock::SocketHandler)
 }  // close namespace
--- a/media/mtransport/transportlayerprsock.h
+++ b/media/mtransport/transportlayerprsock.h
@@ -81,17 +81,17 @@ class TransportLayerPrsock : public Tran
         // TODO(jesup): better check? Does it matter? (likely no)
         *aIsLocal = false;
       }
 
       virtual uint64_t ByteCountSent() { return 0; }
       virtual uint64_t ByteCountReceived() { return 0; }
 
       // nsISupports methods
-      NS_DECL_ISUPPORTS
+      NS_DECL_THREADSAFE_ISUPPORTS
 
       private:
       TransportLayerPrsock *prsock_;
       PRFileDesc *fd_;
    private:
     DISALLOW_COPY_ASSIGN(SocketHandler);
   };
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -311,17 +311,17 @@ private:
   std::string mSdpStr;
   cc_call_state_t mCallState;
   fsmdef_states_t mFsmState;
   std::string mStateStr;
   std::string mFsmStateStr;
   nsRefPtr<RemoteSourceStreamInfo> mRemoteStream;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(PeerConnectionImpl, IPeerConnection)
+NS_IMPL_ISUPPORTS1(PeerConnectionImpl, IPeerConnection)
 
 PeerConnectionImpl::PeerConnectionImpl()
 : mRole(kRoleUnknown)
   , mCall(NULL)
   , mReadyState(kNew)
   , mSignalingState(kSignalingStable)
   , mIceState(kIceGathering)
   , mPCObserver(NULL)
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
@@ -174,17 +174,17 @@ public:
     kInvalidState                     = 4,
     kInvalidSessionDescription        = 5,
     kIncompatibleSessionDescription   = 6,
     kIncompatibleConstraints          = 7,
     kIncompatibleMediaStreamTrack     = 8,
     kInternalError                    = 9
   };
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_IPEERCONNECTION
 
   static PeerConnectionImpl* CreatePeerConnection();
   static nsresult ConvertRTCConfiguration(const JS::Value& aSrc,
     IceConfiguration *aDst, JSContext* aCx);
   static nsresult ConvertConstraints(
     const JS::Value& aConstraints, MediaConstraints* aObj, JSContext* aCx);
   static already_AddRefed<DOMMediaStream> MakeMediaStream(nsPIDOMWindow* aWindow,
--- a/media/webrtc/signaling/test/FakeMediaStreams.h
+++ b/media/webrtc/signaling/test/FakeMediaStreams.h
@@ -86,17 +86,17 @@ Fake_MediaPeriodic(Fake_MediaStream *aSt
                                                 mCount(0) {}
   virtual ~Fake_MediaPeriodic() {}
   void Detach() {
     mStream = NULL;
   }
 
   int GetTimesCalled() { return mCount; }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSITIMERCALLBACK
 
 protected:
   Fake_MediaStream *mStream;
   int mCount;
 };
 
 
@@ -187,17 +187,17 @@ public:
   Fake_DOMMediaStream(Fake_MediaStream *stream) :
       mMediaStream(stream) {}
 
   virtual ~Fake_DOMMediaStream() {
     // Note: memory leak
     mMediaStream->Stop();
   }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   static already_AddRefed<Fake_DOMMediaStream>
   CreateSourceStream(nsIDOMWindow* aWindow, uint32_t aHintContents) {
     Fake_SourceMediaStream *source = new Fake_SourceMediaStream();
 
     nsRefPtr<Fake_DOMMediaStream> ds = new Fake_DOMMediaStream(source);
     ds->SetHintContents(aHintContents);
 
--- a/media/webrtc/signaling/test/FakeMediaStreamsImpl.h
+++ b/media/webrtc/signaling/test/FakeMediaStreamsImpl.h
@@ -8,17 +8,17 @@
 #include "FakeMediaStreams.h"
 
 #include "nspr.h"
 #include "nsError.h"
 
 static const int AUDIO_BUFFER_SIZE = 1600;
 static const int NUM_CHANNELS      = 2;
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(Fake_DOMMediaStream, nsIDOMMediaStream)
+NS_IMPL_ISUPPORTS1(Fake_DOMMediaStream, nsIDOMMediaStream)
 
 // Fake_SourceMediaStream
 nsresult Fake_SourceMediaStream::Start() {
   mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
   if (!mTimer) {
     return NS_ERROR_FAILURE;
   }
 
@@ -101,17 +101,17 @@ void Fake_AudioStreamSource::Periodic() 
                                     0, // Offset TODO(ekr@rtfm.com) fix
                                     0, // ???
                                     segment);
   }
 }
 
 
 // Fake_MediaPeriodic
-NS_IMPL_THREADSAFE_ISUPPORTS1(Fake_MediaPeriodic, nsITimerCallback)
+NS_IMPL_ISUPPORTS1(Fake_MediaPeriodic, nsITimerCallback)
 
 NS_IMETHODIMP
 Fake_MediaPeriodic::Notify(nsITimer *timer) {
   if (mStream)
     mStream->Periodic();
   ++mCount;
   return NS_OK;
 }
--- a/media/webrtc/signaling/test/signaling_unittests.cpp
+++ b/media/webrtc/signaling/test/signaling_unittests.cpp
@@ -172,35 +172,35 @@ public:
     name(aName),
     pc(peerConnection) {
   }
 
   virtual ~TestObserver() {}
 
   std::vector<DOMMediaStream *> GetStreams() { return streams; }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_IPEERCONNECTIONOBSERVER
 
   ResponseState state;
   char *lastString;
   sipcc::PeerConnectionImpl::Error lastStatusCode;
   uint32_t lastStateType;
   int addIceSuccessCount;
   bool onAddStreamCalled;
   std::string name;
 
 private:
   sipcc::PeerConnectionImpl *pc;
   std::vector<DOMMediaStream *> streams;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(TestObserver,
-                              IPeerConnectionObserver,
-                              nsISupportsWeakReference)
+NS_IMPL_ISUPPORTS2(TestObserver,
+                   IPeerConnectionObserver,
+                   nsISupportsWeakReference)
 
 NS_IMETHODIMP
 TestObserver::OnCreateOfferSuccess(const char* offer)
 {
   lastString = strdup(offer);
   state = stateSuccess;
   std::cout << name << ": onCreateOfferSuccess = " << std::endl << indent(offer)
             << std::endl;