Bug 708901 - Migrate to nsTHashSet in xpcom. r=xpcom-reviewers,kmag

Depends on D109326

Differential Revision: https://phabricator.services.mozilla.com/D109327
This commit is contained in:
Simon Giesecke 2021-03-23 10:36:39 +00:00
Родитель 146858a245
Коммит 810d88095a
2 изменённых файлов: 6 добавлений и 6 удалений

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

@ -1816,8 +1816,8 @@ void CycleCollectedJSRuntime::PrepareWaitingZonesForGC() {
if (mZonesWaitingForGC.Count() == 0) {
JS::PrepareForFullGC(cx);
} else {
for (auto iter = mZonesWaitingForGC.Iter(); !iter.Done(); iter.Next()) {
JS::PrepareZoneForGC(cx, iter.Get()->GetKey());
for (const auto& key : mZonesWaitingForGC) {
JS::PrepareZoneForGC(cx, key);
}
mZonesWaitingForGC.Clear();
}
@ -1829,7 +1829,7 @@ void CycleCollectedJSRuntime::OnZoneDestroyed(JSFreeOp* aFop, JS::Zone* aZone) {
// happen if a zone is added to the set during an incremental GC in which it
// is later destroyed.
CycleCollectedJSRuntime* runtime = Get();
runtime->mZonesWaitingForGC.RemoveEntry(aZone);
runtime->mZonesWaitingForGC.Remove(aZone);
}
void CycleCollectedJSRuntime::EnvironmentPreparer::invoke(

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

@ -22,7 +22,7 @@
#include "nsTHashMap.h"
#include "nsHashKeys.h"
#include "nsStringFwd.h"
#include "nsTHashtable.h"
#include "nsTHashSet.h"
class nsCycleCollectionNoteRootCallback;
class nsIException;
@ -333,7 +333,7 @@ class CycleCollectedJSRuntime {
// Add aZone to the set of zones waiting for a GC.
void AddZoneWaitingForGC(JS::Zone* aZone) {
mZonesWaitingForGC.PutEntry(aZone);
mZonesWaitingForGC.Insert(aZone);
}
static void OnZoneDestroyed(JSFreeOp* aFop, JS::Zone* aZone);
@ -389,7 +389,7 @@ class CycleCollectedJSRuntime {
InfallibleAllocPolicy>
mPreservedNurseryObjects;
nsTHashtable<nsPtrHashKey<JS::Zone>> mZonesWaitingForGC;
nsTHashSet<JS::Zone*> mZonesWaitingForGC;
struct EnvironmentPreparer : public js::ScriptEnvironmentPreparer {
void invoke(JS::HandleObject global, Closure& closure) override;