Bug 883360 - Remove bool operator and nsMainThreadPtrHolder conversion. r=bsmedberg
authorArnaud Sourioux <six.dsn@gmail.com>
Fri, 19 Jul 2013 12:53:12 -0400
changeset 151556 7900b47971c79d954bd8eef2be573604e290bf79
parent 151555 67661dd965761efe0badd4a67c7d98b4baa82646
child 151557 79c68a7730803e83326138fc4c264a28d5b9a26f
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)
reviewersbsmedberg
bugs883360
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 883360 - Remove bool operator and nsMainThreadPtrHolder conversion. r=bsmedberg
netwerk/base/src/nsServerSocket.cpp
netwerk/base/src/nsUDPServerSocket.cpp
netwerk/dns/nsDNSService2.cpp
toolkit/components/url-classifier/nsUrlClassifierProxies.h
xpcom/glue/nsProxyRelease.h
--- a/netwerk/base/src/nsServerSocket.cpp
+++ b/netwerk/base/src/nsServerSocket.cpp
@@ -365,17 +365,17 @@ public:
   { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSISERVERSOCKETLISTENER
 
   class OnSocketAcceptedRunnable : public nsRunnable
   {
   public:
-    OnSocketAcceptedRunnable(nsMainThreadPtrHolder<nsIServerSocketListener>* aListener,
+    OnSocketAcceptedRunnable(const nsMainThreadPtrHandle<nsIServerSocketListener>& aListener,
                              nsIServerSocket* aServ,
                              nsISocketTransport* aTransport)
       : mListener(aListener)
       , mServ(aServ)
       , mTransport(aTransport)
     { }
     
     NS_DECL_NSIRUNNABLE
@@ -384,17 +384,17 @@ public:
     nsMainThreadPtrHandle<nsIServerSocketListener> mListener;
     nsCOMPtr<nsIServerSocket> mServ;
     nsCOMPtr<nsISocketTransport> mTransport;
   };
 
   class OnStopListeningRunnable : public nsRunnable
   {
   public:
-    OnStopListeningRunnable(nsMainThreadPtrHolder<nsIServerSocketListener>* aListener,
+    OnStopListeningRunnable(const nsMainThreadPtrHandle<nsIServerSocketListener>& aListener,
                             nsIServerSocket* aServ,
                             nsresult aStatus)
       : mListener(aListener)
       , mServ(aServ)
       , mStatus(aStatus)
     { }
 
     NS_DECL_NSIRUNNABLE
--- a/netwerk/base/src/nsUDPServerSocket.cpp
+++ b/netwerk/base/src/nsUDPServerSocket.cpp
@@ -518,17 +518,17 @@ public:
   { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUDPSERVERSOCKETLISTENER
 
   class OnPacketReceivedRunnable : public nsRunnable
   {
   public:
-    OnPacketReceivedRunnable(nsMainThreadPtrHolder<nsIUDPServerSocketListener>* aListener,
+    OnPacketReceivedRunnable(const nsMainThreadPtrHandle<nsIUDPServerSocketListener>& aListener,
                      nsIUDPServerSocket* aServ,
                      nsIUDPMessage* aMessage)
       : mListener(aListener)
       , mServ(aServ)
       , mMessage(aMessage)
     { }
 
     NS_DECL_NSIRUNNABLE
@@ -537,17 +537,17 @@ public:
     nsMainThreadPtrHandle<nsIUDPServerSocketListener> mListener;
     nsCOMPtr<nsIUDPServerSocket> mServ;
     nsCOMPtr<nsIUDPMessage> mMessage;
   };
 
   class OnStopListeningRunnable : public nsRunnable
   {
   public:
-    OnStopListeningRunnable(nsMainThreadPtrHolder<nsIUDPServerSocketListener>* aListener,
+    OnStopListeningRunnable(const nsMainThreadPtrHandle<nsIUDPServerSocketListener>& aListener,
                             nsIUDPServerSocket* aServ,
                             nsresult aStatus)
       : mListener(aListener)
       , mServ(aServ)
       , mStatus(aStatus)
     { }
 
     NS_DECL_NSIRUNNABLE
--- a/netwerk/dns/nsDNSService2.cpp
+++ b/netwerk/dns/nsDNSService2.cpp
@@ -533,17 +533,17 @@ public:
   { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDNSLISTENER
 
   class OnLookupCompleteRunnable : public nsRunnable
   {
   public:
-    OnLookupCompleteRunnable(nsMainThreadPtrHolder<nsIDNSListener>* aListener,
+    OnLookupCompleteRunnable(const nsMainThreadPtrHandle<nsIDNSListener>& aListener,
                              nsICancelable* aRequest,
                              nsIDNSRecord* aRecord,
                              nsresult aStatus)
       : mListener(aListener)
       , mRequest(aRequest)
       , mRecord(aRecord)
       , mStatus(aStatus)
     { }
--- a/toolkit/components/url-classifier/nsUrlClassifierProxies.h
+++ b/toolkit/components/url-classifier/nsUrlClassifierProxies.h
@@ -166,17 +166,17 @@ public:
   { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIURLCLASSIFIERLOOKUPCALLBACK
 
   class LookupCompleteRunnable : public nsRunnable
   {
   public:
-    LookupCompleteRunnable(nsMainThreadPtrHolder<nsIUrlClassifierLookupCallback>* aTarget,
+    LookupCompleteRunnable(const nsMainThreadPtrHandle<nsIUrlClassifierLookupCallback>& aTarget,
                            mozilla::safebrowsing::LookupResultArray *aResults)
       : mTarget(aTarget)
       , mResults(aResults)
     { }
 
     NS_DECL_NSIRUNNABLE
 
   private:
@@ -196,17 +196,17 @@ public:
   { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIURLCLASSIFIERCALLBACK
 
   class HandleEventRunnable : public nsRunnable
   {
   public:
-    HandleEventRunnable(nsMainThreadPtrHolder<nsIUrlClassifierCallback>* aTarget,
+    HandleEventRunnable(const nsMainThreadPtrHandle<nsIUrlClassifierCallback>& aTarget,
                         const nsACString& aValue)
       : mTarget(aTarget)
       , mValue(aValue)
     { }
 
     NS_DECL_NSIRUNNABLE
 
   private:
@@ -227,17 +227,17 @@ public:
   { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIURLCLASSIFIERUPDATEOBSERVER
 
   class UpdateUrlRequestedRunnable : public nsRunnable
   {
   public:
-    UpdateUrlRequestedRunnable(nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>* aTarget,
+    UpdateUrlRequestedRunnable(const nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver>& aTarget,
                                const nsACString& aURL,
                                const nsACString& aTable,
                                const nsACString& aServerMAC)
       : mTarget(aTarget)
       , mURL(aURL)
       , mTable(aTable)
       , mServerMAC(aServerMAC)
     { }
@@ -247,30 +247,30 @@ public:
   private:
     nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
     nsCString mURL, mTable, mServerMAC;
   };
 
   class RekeyRequestedRunnable : public nsRunnable
   {
   public:
-    RekeyRequestedRunnable(nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>* aTarget)
+    RekeyRequestedRunnable(const nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver>& aTarget)
       : mTarget(aTarget)
     { }
 
     NS_DECL_NSIRUNNABLE
 
   private:
     nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
   };
 
   class StreamFinishedRunnable : public nsRunnable
   {
   public:
-    StreamFinishedRunnable(nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>* aTarget,
+    StreamFinishedRunnable(const nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver>& aTarget,
                            nsresult aStatus, uint32_t aDelay)
       : mTarget(aTarget)
       , mStatus(aStatus)
       , mDelay(aDelay)
     { }
 
     NS_DECL_NSIRUNNABLE
 
@@ -278,33 +278,33 @@ public:
     nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
     nsresult mStatus;
     uint32_t mDelay;
   };
 
   class UpdateErrorRunnable : public nsRunnable
   {
   public:
-    UpdateErrorRunnable(nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>* aTarget,
+    UpdateErrorRunnable(const nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver>& aTarget,
                         nsresult aError)
       : mTarget(aTarget)
       , mError(aError)
     { }
 
     NS_DECL_NSIRUNNABLE
 
   private:
     nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
     nsresult mError;
   };
 
   class UpdateSuccessRunnable : public nsRunnable
   {
   public:
-    UpdateSuccessRunnable(nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>* aTarget,
+    UpdateSuccessRunnable(const nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver>& aTarget,
                           uint32_t aRequestedTimeout)
       : mTarget(aTarget)
       , mRequestedTimeout(aRequestedTimeout)
     { }
 
     NS_DECL_NSIRUNNABLE
 
   private:
--- a/xpcom/glue/nsProxyRelease.h
+++ b/xpcom/glue/nsProxyRelease.h
@@ -175,18 +175,16 @@ class nsMainThreadPtrHandle
   nsMainThreadPtrHandle() : mPtr(NULL) {}
   nsMainThreadPtrHandle(nsMainThreadPtrHolder<T> *aHolder) : mPtr(aHolder) {}
   nsMainThreadPtrHandle(const nsMainThreadPtrHandle& aOther) : mPtr(aOther.mPtr) {}
   nsMainThreadPtrHandle& operator=(const nsMainThreadPtrHandle& aOther) {
     mPtr = aOther.mPtr;
     return *this;
   }
 
-  operator nsMainThreadPtrHolder<T>*() { return mPtr.get(); }
-
   // These all call through to nsMainThreadPtrHolder, and thus implicitly
   // assert that we're on the main thread. Off-main-thread consumers must treat
   // these handles as opaque.
   T* get()
   {
     if (mPtr) {
       return mPtr.get()->get();
     }
@@ -198,18 +196,16 @@ class nsMainThreadPtrHandle
       return mPtr.get()->get();
     }
     return nullptr;
   }
 
   operator T*() { return get(); }
   T* operator->() { return get(); }
 
-  operator bool() { return get(); }
-
   // These are safe to call on other threads with appropriate external locking.
   bool operator==(const nsMainThreadPtrHandle<T>& aOther) const {
     if (!mPtr || !aOther.mPtr)
       return mPtr == aOther.mPtr;
     return *mPtr == *aOther.mPtr;
   }
   bool operator!() { return !mPtr; }
 };