Bug 1766137 - Avoid holding the lock when calling nsThread::Shutdown, r=necko-reviewers,dragana

Differential Revision: https://phabricator.services.mozilla.com/D146280
This commit is contained in:
Kershaw Chang 2022-05-18 13:01:32 +00:00
Родитель 84b7cbf6ca
Коммит 9153fef79a
2 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -600,11 +600,14 @@ TRRService::Observe(nsISupports* aSubject, const char* aTopic,
}
}
} else if (!strcmp(aTopic, "xpcom-shutdown-threads")) {
mShutdown = true;
// If a confirmation is still in progress we record the event.
// Since there should be no more confirmations after this, the shutdown
// reason would not really be recorded in telemetry.
MutexSingleWriterAutoLock lock(mLock);
mConfirmation.RecordEvent("shutdown", lock);
{
MutexSingleWriterAutoLock lock(mLock);
mConfirmation.RecordEvent("shutdown", lock);
}
if (sTRRBackgroundThread) {
nsCOMPtr<nsIThread> thread;
@ -618,7 +621,7 @@ TRRService::Observe(nsISupports* aSubject, const char* aTopic,
}
void TRRService::RebuildSuffixList(nsTArray<nsCString>&& aSuffixList) {
if (!StaticPrefs::network_trr_split_horizon_mitigations()) {
if (!StaticPrefs::network_trr_split_horizon_mitigations() || mShutdown) {
return;
}

Просмотреть файл

@ -131,6 +131,7 @@ class TRRService : public TRRServiceBase,
Atomic<bool, Relaxed> mCaptiveIsPassed{
false}; // set when captive portal check is passed
Atomic<bool, Relaxed> mDisableIPv6; // don't even try
Atomic<bool, Relaxed> mShutdown{false};
// TRR Blocklist storage
// mTRRBLStorage is only modified on the main thread, but we query whether it