Bug 1434206 - Clarify when the lookupcache arrays should be cleared. r?gcp draft
authorFrancois Marier <francois@mozilla.com>
Mon, 21 May 2018 15:58:12 -0700
changeset 805427 34741e20c984f304c073a9feb3146b29d2f3ec30
parent 805426 5ded5f6a543a9cff3d0c133c6bf0fd1b94c76e78
child 805428 cdb199da28f9a33a7bcf817288db2935b58967f4
push id112654
push userfmarier@mozilla.com
push dateThu, 07 Jun 2018 20:10:46 +0000
reviewersgcp
bugs1434206
milestone62.0a1
Bug 1434206 - Clarify when the lookupcache arrays should be cleared. r?gcp MozReview-Commit-ID: 7smtnCC0MGT
toolkit/components/url-classifier/Classifier.cpp
--- a/toolkit/components/url-classifier/Classifier.cpp
+++ b/toolkit/components/url-classifier/Classifier.cpp
@@ -691,16 +691,19 @@ Classifier::AsyncApplyUpdates(const Tabl
   //         Caller thread      |       Update thread
   // --------------------------------------------------------
   //                            |    ApplyUpdatesBackground
   //    (processing other task) |    (bg-update done. ping back to caller thread)
   //    (processing other task) |    idle...
   //    ApplyUpdatesForeground  |
   //          callback          |
 
+  MOZ_ASSERT(mNewLookupCaches.IsEmpty(),
+             "There should be no leftovers from a previous update.");
+
   mUpdateInterrupted = false;
   nsresult rv = mRootStoreDirectory->Clone(getter_AddRefs(mRootStoreDirectoryForUpdate));
   if (NS_FAILED(rv)) {
     LOG(("Failed to clone mRootStoreDirectory for update."));
     return rv;
   }
 
   nsCOMPtr<nsIThread> callerThread = NS_GetCurrentThread();
@@ -879,16 +882,17 @@ Classifier::GetCacheInfo(const nsACStrin
   }
 
   lookupCache->GetCacheInfo(aCache);
 }
 
 void
 Classifier::DropStores()
 {
+  // See the comment in Classifier::Close() before adding anything here.
   mLookupCaches.Clear();
 }
 
 nsresult
 Classifier::RegenActiveTables()
 {
   mActiveTablesCache.Clear();