bug 957368 - standardize and simplify nsNSSShutDownObject implementations r=cviecco r=briansmith
authorDavid Keeler <dkeeler@mozilla.com>
Tue, 14 Jan 2014 09:28:43 -0800
changeset 20395 1625d96094a4c5b9d521511e0da63e64693ac6c1
parent 20394 3f98031eae28ba1a32e6a6924a7b474b3f74370c
child 20396 5e25fcbbc0156ca968aa046f462db2f4adef412e
push id1209
push usermbanner@mozilla.com
push dateTue, 02 Sep 2014 16:59:36 +0000
treeherdercomm-beta@842e0fd167ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscviecco, briansmith
bugs957368
bug 957368 - standardize and simplify nsNSSShutDownObject implementations r=cviecco r=briansmith
mailnews/mime/src/nsCMS.cpp
--- a/mailnews/mime/src/nsCMS.cpp
+++ b/mailnews/mime/src/nsCMS.cpp
@@ -36,33 +36,30 @@ nsCMSMessage::nsCMSMessage()
 nsCMSMessage::nsCMSMessage(NSSCMSMessage *aCMSMsg)
 {
   m_cmsMsg = aCMSMsg;
 }
 
 nsCMSMessage::~nsCMSMessage()
 {
   nsNSSShutDownPreventionLock locker;
-  if (isAlreadyShutDown())
+  if (isAlreadyShutDown()) {
     return;
-
+  }
   destructorSafeDestroyNSSReference();
   shutdown(calledFromObject);
 }
 
 void nsCMSMessage::virtualDestroyNSSReference()
 {
   destructorSafeDestroyNSSReference();
 }
 
 void nsCMSMessage::destructorSafeDestroyNSSReference()
 {
-  if (isAlreadyShutDown())
-    return;
-
   if (m_cmsMsg) {
     NSS_CMSMessage_Destroy(m_cmsMsg);
   }
 }
 
 NS_IMETHODIMP nsCMSMessage::VerifySignature()
 {
   return CommonVerifySignature(nullptr, 0);
@@ -379,33 +376,30 @@ public:
   nsZeroTerminatedCertArray()
   :mCerts(nullptr), mPoolp(nullptr), mSize(0)
   {
   }
   
   ~nsZeroTerminatedCertArray()
   {
     nsNSSShutDownPreventionLock locker;
-    if (isAlreadyShutDown())
+    if (isAlreadyShutDown()) {
       return;
-
+    }
     destructorSafeDestroyNSSReference();
     shutdown(calledFromObject);
   }
 
   void virtualDestroyNSSReference()
   {
     destructorSafeDestroyNSSReference();
   }
 
   void destructorSafeDestroyNSSReference()
   {
-    if (isAlreadyShutDown())
-      return;
-
     if (mCerts)
     {
       for (uint32_t i=0; i < mSize; i++) {
         if (mCerts[i]) {
           CERT_DestroyCertificate(mCerts[i]);
         }
       }
     }
@@ -728,33 +722,30 @@ NS_IMPL_ISUPPORTS1(nsCMSDecoder, nsICMSD
 nsCMSDecoder::nsCMSDecoder()
 : m_dcx(nullptr)
 {
 }
 
 nsCMSDecoder::~nsCMSDecoder()
 {
   nsNSSShutDownPreventionLock locker;
-  if (isAlreadyShutDown())
+  if (isAlreadyShutDown()) {
     return;
-
+  }
   destructorSafeDestroyNSSReference();
   shutdown(calledFromObject);
 }
 
 void nsCMSDecoder::virtualDestroyNSSReference()
 {
   destructorSafeDestroyNSSReference();
 }
 
 void nsCMSDecoder::destructorSafeDestroyNSSReference()
 {
-  if (isAlreadyShutDown())
-    return;
-
   if (m_dcx) {
     NSS_CMSDecoder_Cancel(m_dcx);
     m_dcx = nullptr;
   }
 }
 
 /* void start (in NSSCMSContentCallback cb, in voidPtr arg); */
 NS_IMETHODIMP nsCMSDecoder::Start(NSSCMSContentCallback cb, void * arg)
@@ -814,34 +805,30 @@ NS_IMPL_ISUPPORTS1(nsCMSEncoder, nsICMSE
 nsCMSEncoder::nsCMSEncoder()
 : m_ecx(nullptr)
 {
 }
 
 nsCMSEncoder::~nsCMSEncoder()
 {
   nsNSSShutDownPreventionLock locker;
-  if (isAlreadyShutDown())
+  if (isAlreadyShutDown()) {
     return;
-
+  }
   destructorSafeDestroyNSSReference();
   shutdown(calledFromObject);
 }
 
 void nsCMSEncoder::virtualDestroyNSSReference()
 {
   destructorSafeDestroyNSSReference();
 }
 
 void nsCMSEncoder::destructorSafeDestroyNSSReference()
 {
-  nsNSSShutDownPreventionLock locker;
-  if (isAlreadyShutDown())
-    return;
-
   if (m_ecx)
     NSS_CMSEncoder_Cancel(m_ecx);
 }
 
 /* void start (); */
 NS_IMETHODIMP nsCMSEncoder::Start(nsICMSMessage *aMsg, NSSCMSContentCallback cb, void * arg)
 {
   nsNSSShutDownPreventionLock locker;