Bug 1434206 - Clarify when the lookupcache arrays should be cleared. r?gcp
MozReview-Commit-ID: 7smtnCC0MGT
--- 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();