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 467872 b1b041990577
parent 467871 3fdd157bb698
child 467873 220bf5cd9e2a
push id180
push userfmarier@mozilla.com
push dateTue, 29 May 2018 01:16:16 +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();