Bug 884061 - Part 3m: Use NS_DECL_THREADSAFE_ISUPPORTS in ipc/, r=bent
authorJoshua Cranmer <Pidgeot18@gmail.com>
Thu, 18 Jul 2013 21:23:32 -0500
changeset 139598 ed39337cc38f9573bfc6a82e1680e221fe2c0a60
parent 139597 c00e38f175be47ca1441e2ea5e46ad4114e4f66a
child 139599 7df0367427d3bb2d0e9912fbbd335bbede179be4
push id31415
push userPidgeot18@gmail.com
push dateTue, 23 Jul 2013 13:48:21 +0000
treeherdermozilla-inbound@c4d279b10128 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
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 3m: Use NS_DECL_THREADSAFE_ISUPPORTS in ipc/, r=bent
ipc/glue/FileDescriptorUtils.cpp
ipc/glue/FileDescriptorUtils.h
ipc/glue/MessagePump.cpp
ipc/glue/MessagePump.h
ipc/glue/RPCChannel.h
--- a/ipc/glue/FileDescriptorUtils.cpp
+++ b/ipc/glue/FileDescriptorUtils.cpp
@@ -31,17 +31,17 @@ CloseFileRunnable::~CloseFileRunnable()
 {
   if (mFileDescriptor.IsValid()) {
     // It's probably safer to take the main thread IO hit here rather than leak
     // the file descriptor.
     CloseFile();
   }
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(CloseFileRunnable, nsIRunnable)
+NS_IMPL_ISUPPORTS1(CloseFileRunnable, nsIRunnable)
 
 void
 CloseFileRunnable::Dispatch()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsIEventTarget> eventTarget =
     do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
--- a/ipc/glue/FileDescriptorUtils.h
+++ b/ipc/glue/FileDescriptorUtils.h
@@ -26,17 +26,17 @@ public:
   CloseFileRunnable(const FileDescriptor& aFileDescriptor)
 #ifdef DEBUG
   ;
 #else
   : mFileDescriptor(aFileDescriptor)
   { }
 #endif
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   void Dispatch();
 
 private:
   ~CloseFileRunnable();
 
   void CloseFile();
--- a/ipc/glue/MessagePump.cpp
+++ b/ipc/glue/MessagePump.cpp
@@ -18,17 +18,17 @@
 #include "AndroidBridge.h"
 #endif
 
 using mozilla::ipc::DoWorkRunnable;
 using mozilla::ipc::MessagePump;
 using mozilla::ipc::MessagePumpForChildProcess;
 using base::TimeTicks;
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(DoWorkRunnable, nsIRunnable, nsITimerCallback)
+NS_IMPL_ISUPPORTS2(DoWorkRunnable, nsIRunnable, nsITimerCallback)
 
 NS_IMETHODIMP
 DoWorkRunnable::Run()
 {
   MessageLoop* loop = MessageLoop::current();
   NS_ASSERTION(loop, "Shouldn't be null!");
   if (loop) {
     bool nestableTasksAllowed = loop->NestableTasksAllowed();
--- a/ipc/glue/MessagePump.h
+++ b/ipc/glue/MessagePump.h
@@ -24,17 +24,17 @@ class MessagePump;
 
 class DoWorkRunnable MOZ_FINAL : public nsIRunnable,
                                  public nsITimerCallback
 {
 public:
   DoWorkRunnable(MessagePump* aPump)
   : mPump(aPump) { }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
   NS_DECL_NSITIMERCALLBACK
 
 private:
   MessagePump* mPump;
 };
 
 class MessagePump : public base::MessagePumpDefault
--- a/ipc/glue/RPCChannel.h
+++ b/ipc/glue/RPCChannel.h
@@ -10,17 +10,17 @@
 #include <stdio.h>
 
 #include <deque>
 #include <stack>
 #include <vector>
 
 #include "base/basictypes.h"
 
-#include "nsAtomicRefcnt.h"
+#include "nsISupportsImpl.h"
 
 #include "mozilla/ipc/SyncChannel.h"
 #include "nsAutoPtr.h"
 
 namespace mozilla {
 namespace ipc {
 //-----------------------------------------------------------------------------
 
@@ -387,32 +387,25 @@ private:
     //
     // All dequeuing tasks require a single point of cancellation,
     // which is handled via a reference-counted task.
     //
     class RefCountedTask
     {
       public:
         RefCountedTask(CancelableTask* aTask)
-        : mTask(aTask)
-        , mRefCnt(0) {}
+        : mTask(aTask) {}
         ~RefCountedTask() { delete mTask; }
         void Run() { mTask->Run(); }
         void Cancel() { mTask->Cancel(); }
-        void AddRef() {
-            NS_AtomicIncrementRefcnt(mRefCnt);
-        }
-        void Release() {
-            if (NS_AtomicDecrementRefcnt(mRefCnt) == 0)
-                delete this;
-        }
+
+        NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RefCountedTask)
 
       private:
         CancelableTask* mTask;
-        nsrefcnt mRefCnt;
     };
 
     //
     // Wrap an existing task which can be cancelled at any time
     // without the wrapper's knowledge.
     //
     class DequeueTask : public Task
     {