Bug 1374927 - Port
bug 1372453 to C-C [Support to name the callers of ProxyReleaseEvent]. r=jorgk
--- a/calendar/base/backend/libical/calICSService.h
+++ b/calendar/base/backend/libical/calICSService.h
@@ -26,17 +26,17 @@ protected:
ParserWorker(nsIThread *mainThread,
nsIThread *workerThread,
const nsACString &icsString,
calITimezoneProvider *tzProvider,
calIIcsComponentParsingListener *listener) :
mString(icsString), mProvider(tzProvider),
mMainThread(mainThread), mWorkerThread(workerThread)
{
- mListener = new nsMainThreadPtrHolder<calIIcsComponentParsingListener>(listener);
+ mListener = new nsMainThreadPtrHolder<calIIcsComponentParsingListener>("calICSService::mListener", listener);
}
NS_DECL_NSIRUNNABLE
protected:
nsCString mString;
nsCOMPtr<calITimezoneProvider> mProvider;
nsMainThreadPtrHandle<calIIcsComponentParsingListener> mListener;
--- a/ldap/xpcom/src/nsLDAPConnection.cpp
+++ b/ldap/xpcom/src/nsLDAPConnection.cpp
@@ -606,17 +606,17 @@ nsLDAPConnectionRunnable::nsLDAPConnecti
nsLDAPConnection *aConnection)
: mOperationID(aOperationID), mConnection(aConnection)
{
}
nsLDAPConnectionRunnable::~nsLDAPConnectionRunnable()
{
if (mConnection) {
- NS_ReleaseOnMainThread(mConnection.forget());
+ NS_ReleaseOnMainThread("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(m_baseURL.forget());
- NS_ReleaseOnMainThread(mMimeHeaders.forget());
- NS_ReleaseOnMainThread(m_searchSession.forget());
- NS_ReleaseOnMainThread(mMsgHeaderSink.forget());
+ 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());
nsTObserverArray<nsCOMPtr<nsIUrlListener>>::ForwardIterator iter(mUrlListeners);
while (iter.HasMore()) {
nsCOMPtr<nsIUrlListener> listener = iter.GetNext();
if (listener)
- NS_ReleaseOnMainThread(listener.forget());
+ NS_ReleaseOnMainThread("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(dont_AddRef(mMsgWindow));
+ NS_ReleaseOnMainThread("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(m_mockChannel.forget());
+ NS_ReleaseOnMainThread("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(m_channelListener.forget());
+ NS_ReleaseOnMainThread("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(mailnewsurl.forget());
+ NS_ReleaseOnMainThread("nsImapProtocol::m_runningUrl", mailnewsurl.forget());
}
saveFolderSink = nullptr;
}
class nsImapThreadShutdownEvent : public mozilla::Runnable {
public:
nsImapThreadShutdownEvent(nsIThread *thread) : mThread(thread) {
@@ -1087,17 +1087,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(m_runningUrl.forget());
+ NS_ReleaseOnMainThread("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;
@@ -1106,17 +1106,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(releaseOnMain.forget());
+ NS_ReleaseOnMainThread("nsImapProtocol::this", releaseOnMain.forget());
return NS_OK;
}
//
// Must be called from UI thread only
//
NS_IMETHODIMP nsImapProtocol::CloseStreams()
{
@@ -1884,17 +1884,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(copyState.forget());
+ NS_ReleaseOnMainThread("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
@@ -468,17 +468,17 @@ OAuth2ThreadHelper::OAuth2ThreadHelper(n
mServer(aServer)
{
}
OAuth2ThreadHelper::~OAuth2ThreadHelper()
{
if (mOAuth2Support)
{
- NS_ReleaseOnMainThread(mOAuth2Support.forget());
+ NS_ReleaseOnMainThread("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(mReceiver.forget());
+ NS_ReleaseOnMainThread("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(mReceiver.forget());
+ NS_ReleaseOnMainThread("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(mReceiver.forget());
+ NS_ReleaseOnMainThread("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(mReceiver.forget());
+ NS_ReleaseOnMainThread("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(mReceiver.forget());
+ NS_ReleaseOnMainThread("ImapProtocolSinkProxy::mReceiver", mReceiver.forget());
}
nsCOMPtr<nsIImapProtocolSink> mReceiver;
};
class msgIOAuth2Module;
class nsIMsgIncomingServer;
class nsIVariant;
class nsIWritableVariant;
--- a/mailnews/mime/src/mimecms.cpp
+++ b/mailnews/mime/src/mimecms.cpp
@@ -280,17 +280,17 @@ nsresult ProxySignedStatus(const nsMainT
}
NS_IMPL_ISUPPORTS(nsSMimeVerificationListener, nsISMimeVerificationListener)
nsSMimeVerificationListener::nsSMimeVerificationListener(const char *aFromAddr, const char *aFromName,
const char *aSenderAddr, const char *aSenderName,
nsIMsgSMIMEHeaderSink *aHeaderSink, int32_t aMimeNestingLevel)
{
- mHeaderSink = new nsMainThreadPtrHolder<nsIMsgSMIMEHeaderSink>(aHeaderSink);
+ mHeaderSink = new nsMainThreadPtrHolder<nsIMsgSMIMEHeaderSink>("nsSMimeVerificationListener::mHeaderSink", aHeaderSink);
mSinkIsNull = !aHeaderSink;
mMimeNestingLevel = aMimeNestingLevel;
mFromAddr = aFromAddr;
mFromName = aFromName;
mSenderAddr = aSenderAddr;
mSenderName = aSenderName;
}