Bug 968023 - Remove nsISimpleEnumerator from import thread. r=Neil
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Tue, 18 Feb 2014 08:40:48 -0500
changeset 19520 22a4aeca5215400249a341a18e33f2812428f98a
parent 19519 5161517dbf4120cd76b729178987436e9b796dc9
child 19521 2c30f12cf81348da76f692b0e9ded3c7477ea33b
push id1133
push usermbanner@mozilla.com
push dateMon, 28 Apr 2014 19:42:02 +0000
treeherdercomm-beta@ca498fc736fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs968023
Bug 968023 - Remove nsISimpleEnumerator from import thread. r=Neil
mailnews/import/src/nsImportMail.cpp
--- a/mailnews/import/src/nsImportMail.cpp
+++ b/mailnews/import/src/nsImportMail.cpp
@@ -129,18 +129,17 @@ public:
   ImportThreadData();
   ~ImportThreadData();
   void DriverDelete();
   void ThreadDelete();
   void DriverAbort();
 };
 
 // forward decl for proxy methods
-nsresult ProxyGetSubFolders(nsIMsgFolder *aFolder,
-                            nsISimpleEnumerator **aEnumerator);
+nsresult ProxyGetSubFolders(nsIMsgFolder *aFolder);
 nsresult ProxyGetChildNamed(nsIMsgFolder *aFolder,const nsAString & aName,
                             nsIMsgFolder **aChild);
 nsresult ProxyGetParent(nsIMsgFolder *aFolder, nsIMsgFolder **aParent);
 nsresult ProxyContainsChildNamed(nsIMsgFolder *aFolder, const nsAString &aName,
                                  bool *aResult);
 nsresult ProxyGenerateUniqueSubfolderName(nsIMsgFolder *aFolder,
                                           const nsAString& aPrefix,
                                           nsIMsgFolder *aOtherFolder,
@@ -724,25 +723,24 @@ ImportMailThread(void *stuff)
   uint32_t    newDepth;
   nsString    lastName;
   char16_t *    pName;
 
   nsCOMPtr<nsIMsgFolder>    curFolder(destRoot);
 
   nsCOMPtr<nsIMsgFolder>          newFolder;
   nsCOMPtr<nsIMsgFolder>          subFolder;
-  nsCOMPtr<nsISimpleEnumerator>   enumerator;
 
   bool              exists;
 
   nsString  success;
   nsString  error;
 
   // GetSubFolders() will initialize folders if they are not already initialized.
-  ProxyGetSubFolders(curFolder, getter_AddRefs(enumerator));
+  ProxyGetSubFolders(curFolder);
 
   IMPORT_LOG1("ImportMailThread: Total number of folders to import = %d.", count);
 
   // Note that the front-end js script only displays one import result string so
   // we combine both good and bad import status into one string (in var 'success').
 
   for (i = 0; (i < count) && !(pData->abort); i++) {
     nsCOMPtr<nsIImportMailboxDescriptor> box =
@@ -766,17 +764,17 @@ ImportMailThread(void *stuff)
           nsImportGenericMail::ReportError(IMPORT_ERROR_MB_FINDCHILD,
                                            lastName.get(),
                                            &error, pData->stringBundle);
           pData->fatalError = true;
           break;
         }
         curFolder = subFolder;
         // Make sure this new parent folder obj has the correct subfolder list so far.
-        rv = ProxyGetSubFolders(curFolder, getter_AddRefs(enumerator));
+        rv = ProxyGetSubFolders(curFolder);
       }
       else if (newDepth < depth) {
         rv = NS_OK;
         while ((newDepth < depth) && NS_SUCCEEDED(rv)) {
           rv = curFolder->GetParent(getter_AddRefs(curFolder));
           if (NS_FAILED(rv)) {
             IMPORT_LOG1("*** ImportMailThread: Failed to get the interface for parent folder '%s'.", lastName.get());
             nsImportGenericMail::ReportError(IMPORT_ERROR_MB_FINDCHILD,
@@ -995,40 +993,37 @@ bool nsImportGenericMail::CreateFolder(n
  * A better design might be a co-routine-ish design where the ui thread
  * hands off each folder to the import thread and when the thread finishes
  * the folder, the main thread hands it the next folder.
  */
 
 class GetSubFoldersRunnable : public nsRunnable
 {
 public:
-  GetSubFoldersRunnable(nsIMsgFolder *aFolder,
-                        nsISimpleEnumerator **aEnumerator);
+  GetSubFoldersRunnable(nsIMsgFolder *aFolder);
   NS_DECL_NSIRUNNABLE
 private:
   nsCOMPtr<nsIMsgFolder> m_folder;
-  nsISimpleEnumerator **m_enumerator;
 };
 
-GetSubFoldersRunnable::GetSubFoldersRunnable(nsIMsgFolder *aFolder,
-                                             nsISimpleEnumerator **aEnumerator) :
-  m_folder(aFolder), m_enumerator(aEnumerator)
+GetSubFoldersRunnable::GetSubFoldersRunnable(nsIMsgFolder *aFolder) :
+  m_folder(aFolder)
 {
 }
 
 NS_IMETHODIMP GetSubFoldersRunnable::Run()
 {
-  return m_folder->GetSubFolders(m_enumerator);
+  return m_folder->GetSubFolders(nullptr);
 }
 
 
-nsresult ProxyGetSubFolders(nsIMsgFolder *aFolder, nsISimpleEnumerator **aEnumerator)
+nsresult ProxyGetSubFolders(nsIMsgFolder *aFolder)
 {
   nsRefPtr<GetSubFoldersRunnable> getSubFolders =
-    new GetSubFoldersRunnable(aFolder, aEnumerator);
+    new GetSubFoldersRunnable(aFolder);
   return NS_DispatchToMainThread(getSubFolders, NS_DISPATCH_SYNC);
 }
 
 class GetChildNamedRunnable : public nsRunnable
 {
 public:
   GetChildNamedRunnable(nsIMsgFolder *aFolder, const nsAString& aName, nsIMsgFolder **aChild);
   NS_DECL_NSIRUNNABLE