Bug 1381006 - Port bug 1350958 to mailnews: s/NS_ReleaseOnMainThread/NS_ReleaseOnMainThreadSystemGroup/. rs=bustage-fix DONTBUILD
authorJorg K <jorgk@jorgk.com>
Fri, 14 Jul 2017 15:27:34 +0200
changeset 28445 6b9b94ad31c9801780a8fabbf49434fbf53870a8
parent 28444 9faaede6aff6823a8a9df248a4c275b3ac8c19c5
child 28446 61107603efab124c3214304aca1467649862e870
push id1986
push userclokep@gmail.com
push dateWed, 02 Aug 2017 14:43:31 +0000
treeherdercomm-beta@b51c9adf2c9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage-fix
bugs1381006, 1350958
Bug 1381006 - Port bug 1350958 to mailnews: s/NS_ReleaseOnMainThread/NS_ReleaseOnMainThreadSystemGroup/. rs=bustage-fix DONTBUILD
ldap/xpcom/src/nsLDAPConnection.cpp
mailnews/base/util/nsMsgMailNewsUrl.cpp
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsSyncRunnableHelpers.cpp
mailnews/imap/src/nsSyncRunnableHelpers.h
--- a/ldap/xpcom/src/nsLDAPConnection.cpp
+++ b/ldap/xpcom/src/nsLDAPConnection.cpp
@@ -607,17 +607,17 @@ nsLDAPConnectionRunnable::nsLDAPConnecti
                                                    nsLDAPConnection *aConnection)
   : mOperationID(aOperationID),  mConnection(aConnection)
 {
 }
 
 nsLDAPConnectionRunnable::~nsLDAPConnectionRunnable()
 {
   if (mConnection) {
-    NS_ReleaseOnMainThread("nsLDAPConnectionRunnable::mConnection", mConnection.forget());
+    NS_ReleaseOnMainThreadSystemGroup("nsLDAPConnectionRunnable::mConnection", mConnection.forget());
   }
 }
 
 NS_IMPL_ISUPPORTS(nsLDAPConnectionRunnable, nsIRunnable)
 
 NS_IMETHODIMP nsLDAPConnectionRunnable::Run()
 {
   if (!mOperationID) {
--- a/mailnews/base/util/nsMsgMailNewsUrl.cpp
+++ b/mailnews/base/util/nsMsgMailNewsUrl.cpp
@@ -54,26 +54,26 @@ nsMsgMailNewsUrl::nsMsgMailNewsUrl()
 nsMsgMailNewsUrl::~nsMsgMailNewsUrl()
 {
   PR_FREEIF(m_errorMessage);
 
   // In IMAP this URL is created and destroyed on the imap thread,
   // so we must ensure that releases of XPCOM objects (which might be
   // implemented by non-threadsafe JS components) are released on the
   // main thread.
-  NS_ReleaseOnMainThread("nsMsgMailNewsUrl::m_baseURL", m_baseURL.forget());
-  NS_ReleaseOnMainThread("nsMsgMailNewsUrl::mMimeHeaders", mMimeHeaders.forget());
-  NS_ReleaseOnMainThread("nsMsgMailNewsUrl::m_searchSession", m_searchSession.forget());
-  NS_ReleaseOnMainThread("nsMsgMailNewsUrl::mMsgHeaderSink", mMsgHeaderSink.forget());
+  NS_ReleaseOnMainThreadSystemGroup("nsMsgMailNewsUrl::m_baseURL", m_baseURL.forget());
+  NS_ReleaseOnMainThreadSystemGroup("nsMsgMailNewsUrl::mMimeHeaders", mMimeHeaders.forget());
+  NS_ReleaseOnMainThreadSystemGroup("nsMsgMailNewsUrl::m_searchSession", m_searchSession.forget());
+  NS_ReleaseOnMainThreadSystemGroup("nsMsgMailNewsUrl::mMsgHeaderSink", mMsgHeaderSink.forget());
 
   nsTObserverArray<nsCOMPtr<nsIUrlListener>>::ForwardIterator iter(mUrlListeners);
   while (iter.HasMore()) {
     nsCOMPtr<nsIUrlListener> listener = iter.GetNext();
     if (listener)
-      NS_ReleaseOnMainThread("nsMsgMailNewsUrl::mUrlListeners", listener.forget());
+      NS_ReleaseOnMainThreadSystemGroup("nsMsgMailNewsUrl::mUrlListeners", listener.forget());
   }
 }
 
 NS_IMPL_ADDREF(nsMsgMailNewsUrl)
 NS_IMPL_RELEASE(nsMsgMailNewsUrl)
 
 // We want part URLs to QI to nsIURIWithPrincipal so we can give
 // them a "normalised" origin. URLs that already have a "normalised"
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -97,17 +97,17 @@ static const int32_t kMaxSecondsBeforeCh
 class AutoProxyReleaseMsgWindow
 {
   public:
     AutoProxyReleaseMsgWindow()
       : mMsgWindow()
     {}
     ~AutoProxyReleaseMsgWindow()
     {
-      NS_ReleaseOnMainThread("AutoProxyReleaseMsgWindow::mMsgWindow", dont_AddRef(mMsgWindow));
+      NS_ReleaseOnMainThreadSystemGroup("AutoProxyReleaseMsgWindow::mMsgWindow", dont_AddRef(mMsgWindow));
     }
     nsIMsgWindow** StartAssignment()
     {
       MOZ_ASSERT(!mMsgWindow);
       return &mMsgWindow;
     }
     operator nsIMsgWindow*()
     {
@@ -984,32 +984,32 @@ void nsImapProtocol::ReleaseUrlState(boo
     {
       // grab a lock so m_mockChannel doesn't get cleared out
       // from under us.
       MutexAutoLock mon(mLock);
       if (m_mockChannel)
       {
         // Proxy the release of the channel to the main thread.  This is something
         // that the xpcom proxy system should do for us!
-        NS_ReleaseOnMainThread("nsImapProtocol::m_mockChannel", m_mockChannel.forget());
+        NS_ReleaseOnMainThreadSystemGroup("nsImapProtocol::m_mockChannel", m_mockChannel.forget());
       }
     }
   }
 
   m_channelContext = nullptr; // this might be the url - null it out before the final release of the url
   m_imapMessageSink = nullptr;
 
   // Proxy the release of the listener to the main thread.  This is something
   // that the xpcom proxy system should do for us!
   {
     // grab a lock so the m_channelListener doesn't get cleared.
     MutexAutoLock mon(mLock);
     if (m_channelListener)
     {
-      NS_ReleaseOnMainThread("nsImapProtocol::m_channelListener", m_channelListener.forget());
+      NS_ReleaseOnMainThreadSystemGroup("nsImapProtocol::m_channelListener", m_channelListener.forget());
     }
   }
   m_channelInputStream = nullptr;
   m_channelOutputStream = nullptr;
 
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl;
   nsCOMPtr<nsIImapMailFolderSink> saveFolderSink;
 
@@ -1029,17 +1029,17 @@ void nsImapProtocol::ReleaseUrlState(boo
   // Need to null this out whether we have an m_runningUrl or not
   m_imapMailFolderSink = nullptr;
 
   // we want to make sure the imap protocol's last reference to the url gets released
   // back on the UI thread. This ensures that the objects the imap url hangs on to
   // properly get released back on the UI thread.
   if (mailnewsurl)
   {
-    NS_ReleaseOnMainThread("nsImapProtocol::m_runningUrl", mailnewsurl.forget());
+    NS_ReleaseOnMainThreadSystemGroup("nsImapProtocol::m_runningUrl", mailnewsurl.forget());
   }
   saveFolderSink = nullptr;
 }
 
 
 class nsImapThreadShutdownEvent : public mozilla::Runnable {
 public:
   nsImapThreadShutdownEvent(nsIThread *thread)
@@ -1089,17 +1089,17 @@ NS_IMETHODIMP nsImapProtocol::Run()
     RefPtr<nsImapCancelProxy> cancelProxy =
       new nsImapCancelProxy(m_proxyRequest);
     NS_DispatchToMainThread(cancelProxy, NS_DISPATCH_SYNC);
     m_proxyRequest = nullptr;
   }
 
   if (m_runningUrl)
   {
-    NS_ReleaseOnMainThread("nsImapProtocol::m_runningUrl", m_runningUrl.forget());
+    NS_ReleaseOnMainThreadSystemGroup("nsImapProtocol::m_runningUrl", m_runningUrl.forget());
   }
 
   // close streams via UI thread if it's not already done
   if (m_imapProtocolSink)
     m_imapProtocolSink->CloseStreams();
 
   m_imapMailFolderSink = nullptr;
   m_imapMessageSink = nullptr;
@@ -1108,17 +1108,17 @@ NS_IMETHODIMP nsImapProtocol::Run()
   nsCOMPtr<nsIRunnable> ev = new nsImapThreadShutdownEvent(m_iThread);
   if (NS_FAILED(NS_DispatchToMainThread(ev)))
     NS_WARNING("Failed to dispatch nsImapThreadShutdownEvent");
   m_iThread = nullptr;
 
   // Release protocol object on the main thread to avoid destruction of 'this'
   // on the IMAP thread, which causes grief for weak references.
   nsCOMPtr<nsIImapProtocol> releaseOnMain(this);
-  NS_ReleaseOnMainThread("nsImapProtocol::this", releaseOnMain.forget());
+  NS_ReleaseOnMainThreadSystemGroup("nsImapProtocol::this", releaseOnMain.forget());
   return NS_OK;
 }
 
 //
 // Must be called from UI thread only
 //
 NS_IMETHODIMP nsImapProtocol::CloseStreams()
 {
@@ -1886,17 +1886,17 @@ bool nsImapProtocol::ProcessCurrentURL()
     if (copyState)
     {
       rv = imapMailFolderSink->CopyNextStreamMessage(GetServerStateParser().LastCommandSuccessful() &&
                                                 NS_SUCCEEDED(GetConnectionStatus()),
                                                 copyState);
       if (NS_FAILED(rv))
         MOZ_LOG(IMAP, LogLevel::Info, ("CopyNextStreamMessage failed: %" PRIx32 "\n", static_cast<uint32_t>(rv)));
 
-      NS_ReleaseOnMainThread("nsImapProtocol, copyState", copyState.forget());
+      NS_ReleaseOnMainThreadSystemGroup("nsImapProtocol, copyState", copyState.forget());
     }
     // we might need this to stick around for IDLE support
     m_imapMailFolderSink = imapMailFolderSink;
     imapMailFolderSink = nullptr;
   }
   else
     MOZ_LOG(IMAP, LogLevel::Info, ("null imapMailFolderSink\n"));
 
--- a/mailnews/imap/src/nsSyncRunnableHelpers.cpp
+++ b/mailnews/imap/src/nsSyncRunnableHelpers.cpp
@@ -469,17 +469,17 @@ OAuth2ThreadHelper::OAuth2ThreadHelper(n
   mServer(aServer)
 {
 }
 
 OAuth2ThreadHelper::~OAuth2ThreadHelper()
 {
   if (mOAuth2Support)
   {
-    NS_ReleaseOnMainThread("OAuth2ThreadHelper::mOAuth2Support", mOAuth2Support.forget());
+    NS_ReleaseOnMainThreadSystemGroup("OAuth2ThreadHelper::mOAuth2Support", mOAuth2Support.forget());
   }
 }
 
 bool OAuth2ThreadHelper::SupportsOAuth2()
 {
   // Acquire a lock early, before reading anything. Guarantees memory visibility
   // issues.
   MonitorAutoLock lockGuard(mMonitor);
--- a/mailnews/imap/src/nsSyncRunnableHelpers.h
+++ b/mailnews/imap/src/nsSyncRunnableHelpers.h
@@ -31,17 +31,17 @@ public:
   }
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
 private:
   ~StreamListenerProxy() {
-    NS_ReleaseOnMainThread("StreamListenerProxy::mReceiver", mReceiver.forget());
+    NS_ReleaseOnMainThreadSystemGroup("StreamListenerProxy::mReceiver", mReceiver.forget());
   }
   nsCOMPtr<nsIStreamListener> mReceiver;
 };
 
 class ImapMailFolderSinkProxy final : public nsIImapMailFolderSink
 {
 public:
   ImapMailFolderSinkProxy(nsIImapMailFolderSink* receiver)
@@ -50,17 +50,17 @@ public:
     MOZ_DIAGNOSTIC_ASSERT(receiver, "Null receiver, crash now to get feedback instead of later");
   }
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPMAILFOLDERSINK
 
 private:
   ~ImapMailFolderSinkProxy() {
-    NS_ReleaseOnMainThread("ImapMailFolderSinkProxy::mReceiver", mReceiver.forget());
+    NS_ReleaseOnMainThreadSystemGroup("ImapMailFolderSinkProxy::mReceiver", mReceiver.forget());
   }
   nsCOMPtr<nsIImapMailFolderSink> mReceiver;
 };
 
 class ImapServerSinkProxy final : public nsIImapServerSink
 {
 public:
   ImapServerSinkProxy(nsIImapServerSink* receiver)
@@ -69,17 +69,17 @@ public:
     MOZ_DIAGNOSTIC_ASSERT(receiver, "Null receiver, crash now to get feedback instead of later");
   }
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPSERVERSINK
 
 private:
   ~ImapServerSinkProxy() {
-    NS_ReleaseOnMainThread("ImapServerSinkProxy::mReceiver", mReceiver.forget());
+    NS_ReleaseOnMainThreadSystemGroup("ImapServerSinkProxy::mReceiver", mReceiver.forget());
   }
   nsCOMPtr<nsIImapServerSink> mReceiver;
 };
 
 
 class ImapMessageSinkProxy final : public nsIImapMessageSink
 {
 public:
@@ -89,17 +89,17 @@ public:
     MOZ_DIAGNOSTIC_ASSERT(receiver, "Null receiver, crash now to get feedback instead of later");
   }
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPMESSAGESINK
 
 private:
   ~ImapMessageSinkProxy() {
-    NS_ReleaseOnMainThread("ImapMessageSinkProxy::mReceiver", mReceiver.forget());
+    NS_ReleaseOnMainThreadSystemGroup("ImapMessageSinkProxy::mReceiver", mReceiver.forget());
   }
   nsCOMPtr<nsIImapMessageSink> mReceiver;
 };
 
 class ImapProtocolSinkProxy final : public nsIImapProtocolSink
 {
 public:
   ImapProtocolSinkProxy(nsIImapProtocolSink* receiver)
@@ -108,17 +108,17 @@ public:
     MOZ_DIAGNOSTIC_ASSERT(receiver, "Null receiver, crash now to get feedback instead of later");
   }
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPPROTOCOLSINK
 
 private:
   ~ImapProtocolSinkProxy() {
-    NS_ReleaseOnMainThread("ImapProtocolSinkProxy::mReceiver", mReceiver.forget());
+    NS_ReleaseOnMainThreadSystemGroup("ImapProtocolSinkProxy::mReceiver", mReceiver.forget());
   }
   nsCOMPtr<nsIImapProtocolSink> mReceiver;
 };
 
 class msgIOAuth2Module;
 class nsIMsgIncomingServer;
 class nsIVariant;
 class nsIWritableVariant;