From 810d88095ae43f462472b5d87bea24a6b272e386 Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Tue, 23 Mar 2021 10:36:39 +0000 Subject: [PATCH] Bug 708901 - Migrate to nsTHashSet in xpcom. r=xpcom-reviewers,kmag Depends on D109326 Differential Revision: https://phabricator.services.mozilla.com/D109327 --- xpcom/base/CycleCollectedJSRuntime.cpp | 6 +++--- xpcom/base/CycleCollectedJSRuntime.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index 397f0382a34e..4e8d03f22a73 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -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( diff --git a/xpcom/base/CycleCollectedJSRuntime.h b/xpcom/base/CycleCollectedJSRuntime.h index d5a37afc793a..3644d0d06565 100644 --- a/xpcom/base/CycleCollectedJSRuntime.h +++ b/xpcom/base/CycleCollectedJSRuntime.h @@ -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> mZonesWaitingForGC; + nsTHashSet mZonesWaitingForGC; struct EnvironmentPreparer : public js::ScriptEnvironmentPreparer { void invoke(JS::HandleObject global, Closure& closure) override;