Bug 1315386 - Make Safe Browsing code more shutdown-aware. r=francois,gcp.

MozReview-Commit-ID: ATCVfh5YLZl
This commit is contained in:
Thomas Nguyen
2016-11-25 16:02:37 +08:00
parent 142fe6fa96
commit 7064eed520
9 changed files with 133 additions and 34 deletions

View File

@@ -336,6 +336,11 @@ Classifier::DeleteTables(nsIFile* aDirectory, const nsTArray<nsCString>& aTables
void
Classifier::AbortUpdateAndReset(const nsCString& aTable)
{
// We don't need to reset while shutting down. It will only slow us down.
if (nsUrlClassifierDBService::ShutdownHasStarted()) {
return;
}
LOG(("Abort updating table %s.", aTable.get()));
// ResetTables will clear both in-memory & on-disk data.
@@ -946,6 +951,10 @@ nsresult
Classifier::UpdateHashStore(nsTArray<TableUpdate*>* aUpdates,
const nsACString& aTable)
{
if (nsUrlClassifierDBService::ShutdownHasStarted()) {
return NS_ERROR_ABORT;
}
LOG(("Classifier::UpdateHashStore(%s)", PromiseFlatCString(aTable).get()));
HashStore store(aTable, GetProvider(aTable), mRootStoreDirectory);
@@ -1044,6 +1053,9 @@ Classifier::UpdateTableV4(nsTArray<TableUpdate*>* aUpdates,
{
MOZ_ASSERT(!NS_IsMainThread(),
"UpdateTableV4 must be called on the classifier worker thread.");
if (nsUrlClassifierDBService::ShutdownHasStarted()) {
return NS_ERROR_ABORT;
}
LOG(("Classifier::UpdateTableV4(%s)", PromiseFlatCString(aTable).get()));