Bug 708901 - Migrate to nsTHashSet in caps. r=ckerschb

Differential Revision: https://phabricator.services.mozilla.com/D108590
This commit is contained in:
Simon Giesecke
2021-03-24 17:56:45 +00:00
parent a34c1d671f
commit d08a48110c
2 changed files with 5 additions and 8 deletions

View File

@@ -147,7 +147,7 @@ NS_IMETHODIMP
DomainSet::Add(nsIURI* aDomain) {
nsCOMPtr<nsIURI> clone = GetCanonicalClone(aDomain);
NS_ENSURE_TRUE(clone, NS_ERROR_FAILURE);
mHashTable.PutEntry(clone);
mHashTable.Insert(clone);
if (XRE_IsParentProcess()) {
return BroadcastDomainSetChange(mType, ADD_DOMAIN, aDomain);
}
@@ -159,7 +159,7 @@ NS_IMETHODIMP
DomainSet::Remove(nsIURI* aDomain) {
nsCOMPtr<nsIURI> clone = GetCanonicalClone(aDomain);
NS_ENSURE_TRUE(clone, NS_ERROR_FAILURE);
mHashTable.RemoveEntry(clone);
mHashTable.Remove(clone);
if (XRE_IsParentProcess()) {
return BroadcastDomainSetChange(mType, REMOVE_DOMAIN, aDomain);
}
@@ -215,10 +215,7 @@ DomainSet::ContainsSuperDomain(nsIURI* aDomain, bool* aContains) {
}
void DomainSet::CloneSet(nsTArray<RefPtr<nsIURI>>* aDomains) {
for (auto iter = mHashTable.Iter(); !iter.Done(); iter.Next()) {
nsIURI* key = iter.Get()->GetKey();
aDomains->AppendElement(key);
}
AppendToArray(*aDomains, mHashTable);
}
} /* namespace mozilla */

View File

@@ -8,7 +8,7 @@
#define DomainPolicy_h__
#include "nsIDomainPolicy.h"
#include "nsTHashtable.h"
#include "nsTHashSet.h"
#include "nsURIHashKey.h"
namespace mozilla {
@@ -40,7 +40,7 @@ class DomainSet final : public nsIDomainSet {
protected:
virtual ~DomainSet() {}
nsTHashtable<nsURIHashKey> mHashTable;
nsTHashSet<nsURIHashKey> mHashTable;
DomainSetType mType;
};