Bug 833949 - Convert nsMsgMailNewsUrl::m_cachedMemCacheEntries from nsISupportsArray to nsCOMArray. r=Neil
authoraceman <acelists@atlas.sk>
Sat, 26 Jan 2013 12:52:37 -0500
changeset 14755 cb616b4ba9b46c9ab928a82b2f6d34f580565e85
parent 14754 26e91802d679e5e109e541ab999963c6bfa7cbd3
child 14756 5afc408aa274f6fd7a51850f0b69ce7287b91eef
push id867
push userbugzilla@standard8.plus.com
push dateMon, 01 Apr 2013 20:44:27 +0000
treeherdercomm-beta@797726b8d244 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs833949
Bug 833949 - Convert nsMsgMailNewsUrl::m_cachedMemCacheEntries from nsISupportsArray to nsCOMArray. r=Neil
mailnews/base/util/nsMsgMailNewsUrl.cpp
mailnews/base/util/nsMsgMailNewsUrl.h
--- a/mailnews/base/util/nsMsgMailNewsUrl.cpp
+++ b/mailnews/base/util/nsMsgMailNewsUrl.cpp
@@ -713,47 +713,35 @@ NS_IMETHODIMP nsMsgMailNewsUrl:: GetMemC
 }
 
 NS_IMETHODIMP nsMsgMailNewsUrl::SetImageCacheSession(nsICacheSession *imageCacheSession)
 {
   m_imageCacheSession = imageCacheSession;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsMsgMailNewsUrl:: GetImageCacheSession(nsICacheSession **imageCacheSession)
+NS_IMETHODIMP nsMsgMailNewsUrl::GetImageCacheSession(nsICacheSession **imageCacheSession)
 {
   NS_ENSURE_ARG(imageCacheSession);
 
   NS_IF_ADDREF(*imageCacheSession = m_imageCacheSession);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsMsgMailNewsUrl:: CacheCacheEntry(nsICacheEntryDescriptor *cacheEntry)
+NS_IMETHODIMP nsMsgMailNewsUrl::CacheCacheEntry(nsICacheEntryDescriptor *cacheEntry)
 {
-  if (!m_cachedMemCacheEntries)
-    NS_NewISupportsArray(getter_AddRefs(m_cachedMemCacheEntries));
-  if (m_cachedMemCacheEntries)
-  {
-    nsCOMPtr<nsISupports> cacheEntrySupports(do_QueryInterface(cacheEntry));
-    if(cacheEntrySupports)
-      m_cachedMemCacheEntries->AppendElement(cacheEntrySupports);
-  }
+  m_cachedMemCacheEntries.AppendObject(cacheEntry);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsMsgMailNewsUrl:: RemoveCacheEntry(nsICacheEntryDescriptor *cacheEntry)
+NS_IMETHODIMP nsMsgMailNewsUrl::RemoveCacheEntry(nsICacheEntryDescriptor *cacheEntry)
 {
-  if (m_cachedMemCacheEntries)
-  {
-    nsCOMPtr<nsISupports> cacheEntrySupports(do_QueryInterface(cacheEntry));
-    if(cacheEntrySupports)
-      m_cachedMemCacheEntries->RemoveElement(cacheEntrySupports);
-  }
+  m_cachedMemCacheEntries.RemoveObject(cacheEntry);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgMailNewsUrl::GetMimeHeaders(nsIMimeHeaders * *mimeHeaders)
 {
     NS_ENSURE_ARG_POINTER(mimeHeaders);
     NS_IF_ADDREF(*mimeHeaders = mMimeHeaders);
     return (mMimeHeaders) ? NS_OK : NS_ERROR_NULL_POINTER;
--- a/mailnews/base/util/nsMsgMailNewsUrl.h
+++ b/mailnews/base/util/nsMsgMailNewsUrl.h
@@ -8,16 +8,17 @@
 
 #include "nscore.h"
 #include "nsISupports.h"
 #include "nsIUrlListener.h"
 #include "nsTObserverArray.h"
 #include "nsIMsgWindow.h"
 #include "nsIMsgStatusFeedback.h"
 #include "nsCOMPtr.h"
+#include "nsCOMArray.h"
 #include "nsIMimeHeaders.h"
 #include "nsIMsgMailNewsUrl.h"
 #include "nsIURL.h"
 #include "nsILoadGroup.h"
 #include "nsIMsgSearchSession.h"
 #include "nsICacheEntryDescriptor.h"
 #include "nsICacheSession.h"
 #include "nsISupportsArray.h"
@@ -52,17 +53,17 @@ protected:
   nsCOMPtr<nsIURL> m_baseURL;
   nsWeakPtr m_statusFeedbackWeak;
   nsWeakPtr m_msgWindowWeak;
   nsWeakPtr m_loadGroupWeak;
   nsCOMPtr<nsIMimeHeaders> mMimeHeaders;
   nsCOMPtr<nsIMsgSearchSession> m_searchSession;
   nsCOMPtr<nsICacheEntryDescriptor> m_memCacheEntry;
   nsCOMPtr<nsICacheSession> m_imageCacheSession;
-  nsCOMPtr<nsISupportsArray> m_cachedMemCacheEntries;
+  nsCOMArray<nsICacheEntryDescriptor> m_cachedMemCacheEntries;
   nsCOMPtr<nsIMsgHeaderSink> mMsgHeaderSink;
   char *m_errorMessage;
   int64_t mMaxProgress;
   bool m_runningUrl;
   bool m_updatingFolder;
   bool m_addContentToCache;
   bool m_msgIsInLocalCache;
   bool m_suppressErrorMsgs;