Backed out changeset 73ed0515afc2 (bug 1490626) for causing address book and auto-complete slowness (bug 1511885). a=backout
authorJorg K <jorgk@jorgk.com>
Tue, 04 Dec 2018 18:36:10 +0100
changeset 31965 d6e310cff401
parent 31964 fe462e7a581c
child 31966 e4d520b5dc17
push id115
push usermozilla@jorgk.com
push dateTue, 04 Dec 2018 17:41:45 +0000
treeherdercomm-esr60@e4d520b5dc17 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1490626, 1511885
backs out73ed0515afc2
Backed out changeset 73ed0515afc2 (bug 1490626) for causing address book and auto-complete slowness (bug 1511885). a=backout
mailnews/addrbook/src/nsAbMDBDirectory.cpp
mailnews/addrbook/src/nsAddrDatabase.cpp
--- a/mailnews/addrbook/src/nsAbMDBDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbMDBDirectory.cpp
@@ -22,18 +22,16 @@
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsIFile.h"
 #include "nsComponentManagerUtils.h"
 #include "nsMemory.h"
 #include "nsArrayUtils.h"
 #include "nsUnicharUtils.h"
 #include "mozilla/DebugOnly.h"
-#include "nsIObserverService.h"
-#include "mozilla/Services.h"
 
 nsAbMDBDirectory::nsAbMDBDirectory(void):
      nsAbMDBDirProperty(),
      mPerformingQuery(false)
 {
 }
 
 nsAbMDBDirectory::~nsAbMDBDirectory(void)
@@ -658,27 +656,20 @@ NS_IMETHODIMP nsAbMDBDirectory::AddCard(
 
   nsresult rv = NS_OK;
   if (!mDatabase)
     rv = GetAbDatabase();
 
   if (NS_FAILED(rv) || !mDatabase)
     return NS_ERROR_FAILURE;
 
-  if (m_IsMailList) {
+  if (m_IsMailList)
     rv = mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, card, true /* notify */);
-  } else {
+  else
     rv = mDatabase->CreateNewCardAndAddToDB(card, true, this);
-    nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
-    if (observerService) {
-      nsAutoCString thisUID;
-      this->GetUID(thisUID);
-      observerService->NotifyObservers(card, "addrbook-contact-created", NS_ConvertUTF8toUTF16(thisUID).get());
-    }
-  }
   NS_ENSURE_SUCCESS(rv, rv);
 
   mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
 
   NS_IF_ADDREF(*addedCard = card);
   return NS_OK;
 }
 
@@ -690,24 +681,16 @@ NS_IMETHODIMP nsAbMDBDirectory::ModifyCa
   if (!mDatabase)
   {
     rv = GetAbDatabase();
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   rv = mDatabase->EditCard(aModifiedCard, true, this);
   NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
-  if (observerService) {
-    nsAutoCString thisUID;
-    this->GetUID(thisUID);
-    observerService->NotifyObservers(aModifiedCard, "addrbook-contact-updated", NS_ConvertUTF8toUTF16(thisUID).get());
-  }
-
   return mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
 }
 
 NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, bool needToCopyCard)
 {
   NS_ENSURE_ARG_POINTER(aCard);
 
   if (mIsQueryURI)
@@ -742,22 +725,16 @@ NS_IMETHODIMP nsAbMDBDirectory::DropCard
       mDatabase->FindRowByCard(newCard, getter_AddRefs(cardRow));
       if (!cardRow)
         mDatabase->CreateNewCardAndAddToDB(newCard, true /* notify */, this);
       else
         mDatabase->InitCardFromRow(newCard, cardRow);
     }
     // since we didn't copy the card, we don't have to notify that it was inserted
     mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, false /* notify */);
-    nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
-    if (observerService) {
-      nsAutoCString thisUID;
-      this->GetUID(thisUID);
-      observerService->NotifyObservers(newCard, "addrbook-list-member-added", NS_ConvertUTF8toUTF16(thisUID).get());
-    }
   }
   else {
     mDatabase->CreateNewCardAndAddToDB(newCard, true /* notify */, this);
   }
   mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
   return NS_OK;
 }
 
--- a/mailnews/addrbook/src/nsAddrDatabase.cpp
+++ b/mailnews/addrbook/src/nsAddrDatabase.cpp
@@ -26,17 +26,16 @@
 #include "nsIProperty.h"
 #include "nsIVariant.h"
 #include "nsCOMArray.h"
 #include "nsArrayEnumerator.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIAbManager.h"
 #include "mozilla/Services.h"
-#include "nsIObserverService.h"
 
 #define ID_PAB_TABLE            1
 #define ID_DELETEDCARDS_TABLE           2
 
 // There's two books by default, although Mac may have one more, so set this
 // to three. Its not going to affect much, but will save us a few reallocations
 // when the cache is allocated.
 const uint32_t kInitialAddrDBCacheSize = 3;
@@ -1844,21 +1843,16 @@ NS_IMETHODIMP nsAddrDatabase::EditMailLi
   if (notify)
   {
     NotifyListEntryChange(AB_NotifyPropertyChanged, mailList);
 
     if (listCard)
     {
       NotifyCardEntryChange(AB_NotifyPropertyChanged, listCard, mailList);
     }
-
-    nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
-    if (observerService) {
-      observerService->NotifyObservers(mailList, "addrbook-list-updated", nullptr);
-    }
   }
 
   NS_RELEASE(pListRow);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAddrDatabase::ContainsMailList(nsIAbDirectory *mailList, bool *hasList)
 {