forked from mirrors/gecko-dev
Bug 1849204 - Add generic atom hash keys that use the better distributed atom hash, and use it across the tree. r=mstange,xpcom-reviewers,credential-management-reviewers,sgalich,nika
Differential Revision: https://phabricator.services.mozilla.com/D186496
This commit is contained in:
parent
b09db560e8
commit
95707c96bb
30 changed files with 145 additions and 104 deletions
|
|
@ -319,7 +319,7 @@ class AttrIterator {
|
||||||
dom::Element* mElement;
|
dom::Element* mElement;
|
||||||
|
|
||||||
bool mIteratingDefaults;
|
bool mIteratingDefaults;
|
||||||
nsTHashSet<nsRefPtrHashKey<nsAtom>> mOverriddenAttrs;
|
nsTHashSet<RefPtr<nsAtom>> mOverriddenAttrs;
|
||||||
|
|
||||||
const AttrArray* mAttrs;
|
const AttrArray* mAttrs;
|
||||||
uint32_t mAttrIdx;
|
uint32_t mAttrIdx;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
#include "mozilla/a11y/AccGroupInfo.h"
|
#include "mozilla/a11y/AccGroupInfo.h"
|
||||||
#include "mozilla/Variant.h"
|
#include "mozilla/Variant.h"
|
||||||
#include "nsTHashMap.h"
|
#include "nsTHashMap.h"
|
||||||
#include "nsAtom.h"
|
|
||||||
#include "nsStringFwd.h"
|
#include "nsStringFwd.h"
|
||||||
#include "mozilla/gfx/Matrix.h"
|
#include "mozilla/gfx/Matrix.h"
|
||||||
|
|
||||||
|
|
@ -72,7 +71,7 @@ class AccAttributes {
|
||||||
RefPtr<AccAttributes>, uint64_t, UniquePtr<AccGroupInfo>,
|
RefPtr<AccAttributes>, uint64_t, UniquePtr<AccGroupInfo>,
|
||||||
UniquePtr<gfx::Matrix4x4>, nsTArray<uint64_t>>;
|
UniquePtr<gfx::Matrix4x4>, nsTArray<uint64_t>>;
|
||||||
static_assert(sizeof(AttrValueType) <= 16);
|
static_assert(sizeof(AttrValueType) <= 16);
|
||||||
using AtomVariantMap = nsTHashMap<nsRefPtrHashKey<nsAtom>, AttrValueType>;
|
using AtomVariantMap = nsTHashMap<RefPtr<nsAtom>, AttrValueType>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~AccAttributes() = default;
|
~AccAttributes() = default;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include "mozilla/a11y/SelectionManager.h"
|
#include "mozilla/a11y/SelectionManager.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
|
||||||
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIObserver.h"
|
#include "nsIObserver.h"
|
||||||
#include "nsIAccessibleEvent.h"
|
#include "nsIAccessibleEvent.h"
|
||||||
|
|
@ -69,14 +70,14 @@ struct MarkupAttrInfo {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MarkupMapInfo {
|
struct MarkupMapInfo {
|
||||||
const nsStaticAtom* const tag;
|
nsStaticAtom* const tag;
|
||||||
New_Accessible* new_func;
|
New_Accessible* new_func;
|
||||||
a11y::role role;
|
a11y::role role;
|
||||||
MarkupAttrInfo attrs[4];
|
MarkupAttrInfo attrs[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct XULMarkupMapInfo {
|
struct XULMarkupMapInfo {
|
||||||
const nsStaticAtom* const tag;
|
nsStaticAtom* const tag;
|
||||||
New_Accessible* new_func;
|
New_Accessible* new_func;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -381,8 +382,8 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager,
|
||||||
*/
|
*/
|
||||||
static uint32_t gConsumers;
|
static uint32_t gConsumers;
|
||||||
|
|
||||||
using MarkupMap = nsTHashMap<nsPtrHashKey<const nsAtom>,
|
// Can be weak because all atoms are known static
|
||||||
const mozilla::a11y::MarkupMapInfo*>;
|
using MarkupMap = nsTHashMap<nsAtom*, const mozilla::a11y::MarkupMapInfo*>;
|
||||||
MarkupMap mHTMLMarkupMap;
|
MarkupMap mHTMLMarkupMap;
|
||||||
MarkupMap mMathMLMarkupMap;
|
MarkupMap mMathMLMarkupMap;
|
||||||
|
|
||||||
|
|
@ -403,8 +404,7 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager,
|
||||||
const mozilla::a11y::MarkupMapInfo* GetMarkupMapInfoFor(
|
const mozilla::a11y::MarkupMapInfo* GetMarkupMapInfoFor(
|
||||||
mozilla::a11y::Accessible* aAcc) const;
|
mozilla::a11y::Accessible* aAcc) const;
|
||||||
|
|
||||||
nsTHashMap<nsPtrHashKey<const nsAtom>, const mozilla::a11y::XULMarkupMapInfo*>
|
nsTHashMap<nsAtom*, const mozilla::a11y::XULMarkupMapInfo*> mXULMarkupMap;
|
||||||
mXULMarkupMap;
|
|
||||||
|
|
||||||
friend nsAccessibilityService* GetAccService();
|
friend nsAccessibilityService* GetAccService();
|
||||||
friend nsAccessibilityService* GetOrCreateAccService(uint32_t);
|
friend nsAccessibilityService* GetOrCreateAccService(uint32_t);
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
#include "nsTHashSet.h"
|
#include "nsTHashSet.h"
|
||||||
|
#include "nsAtomHashKeys.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class ErrorResult;
|
class ErrorResult;
|
||||||
|
|
@ -493,18 +494,16 @@ class CustomElementRegistry final : public nsISupports, public nsWrapperCache {
|
||||||
void UpgradeCandidates(nsAtom* aKey, CustomElementDefinition* aDefinition,
|
void UpgradeCandidates(nsAtom* aKey, CustomElementDefinition* aDefinition,
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
|
||||||
typedef nsRefPtrHashtable<nsRefPtrHashKey<nsAtom>, CustomElementDefinition>
|
using DefinitionMap =
|
||||||
DefinitionMap;
|
nsRefPtrHashtable<nsAtomHashKey, CustomElementDefinition>;
|
||||||
typedef nsRefPtrHashtable<nsRefPtrHashKey<nsAtom>,
|
using ElementCreationCallbackMap =
|
||||||
CustomElementCreationCallback>
|
nsRefPtrHashtable<nsAtomHashKey, CustomElementCreationCallback>;
|
||||||
ElementCreationCallbackMap;
|
using CandidateMap =
|
||||||
typedef nsClassHashtable<nsRefPtrHashKey<nsAtom>,
|
nsClassHashtable<nsAtomHashKey, nsTHashSet<RefPtr<nsIWeakReference>>>;
|
||||||
nsTHashSet<RefPtr<nsIWeakReference>>>
|
using ConstructorMap =
|
||||||
CandidateMap;
|
JS::GCHashMap<JS::Heap<JSObject*>, RefPtr<nsAtom>,
|
||||||
typedef JS::GCHashMap<JS::Heap<JSObject*>, RefPtr<nsAtom>,
|
js::StableCellHasher<JS::Heap<JSObject*>>,
|
||||||
js::StableCellHasher<JS::Heap<JSObject*>>,
|
js::SystemAllocPolicy>;
|
||||||
js::SystemAllocPolicy>
|
|
||||||
ConstructorMap;
|
|
||||||
|
|
||||||
// Hashtable for custom element definitions in web components.
|
// Hashtable for custom element definitions in web components.
|
||||||
// Custom prototypes are stored in the compartment where definition was
|
// Custom prototypes are stored in the compartment where definition was
|
||||||
|
|
@ -521,8 +520,7 @@ class CustomElementRegistry final : public nsISupports, public nsWrapperCache {
|
||||||
// mCustomDefinitions again to get definitions.
|
// mCustomDefinitions again to get definitions.
|
||||||
ConstructorMap mConstructors;
|
ConstructorMap mConstructors;
|
||||||
|
|
||||||
typedef nsRefPtrHashtable<nsRefPtrHashKey<nsAtom>, Promise>
|
using WhenDefinedPromiseMap = nsRefPtrHashtable<nsAtomHashKey, Promise>;
|
||||||
WhenDefinedPromiseMap;
|
|
||||||
WhenDefinedPromiseMap mWhenDefinedPromiseMap;
|
WhenDefinedPromiseMap mWhenDefinedPromiseMap;
|
||||||
|
|
||||||
// The "upgrade candidates map" from the web components spec. Maps from a
|
// The "upgrade candidates map" from the web components spec. Maps from a
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
|
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
|
||||||
#include "nsIContent.h" // base class
|
#include "nsIContent.h" // base class
|
||||||
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsIHTMLCollection.h"
|
#include "nsIHTMLCollection.h"
|
||||||
#include "nsIWeakReferenceUtils.h"
|
#include "nsIWeakReferenceUtils.h"
|
||||||
|
|
||||||
|
|
@ -230,7 +231,7 @@ class FragmentOrElement : public nsIContent {
|
||||||
* Explicitly set attr-elements, see
|
* Explicitly set attr-elements, see
|
||||||
* https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#explicitly-set-attr-element
|
* https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#explicitly-set-attr-element
|
||||||
*/
|
*/
|
||||||
nsTHashMap<nsRefPtrHashKey<nsAtom>, nsWeakPtr> mExplicitlySetAttrElements;
|
nsTHashMap<RefPtr<nsAtom>, nsWeakPtr> mExplicitlySetAttrElements;
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsDOMSlots : public nsIContent::nsContentSlots {
|
class nsDOMSlots : public nsIContent::nsContentSlots {
|
||||||
|
|
|
||||||
|
|
@ -64,13 +64,13 @@ already_AddRefed<Highlight> Highlight::Constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Highlight::AddToHighlightRegistry(HighlightRegistry& aHighlightRegistry,
|
void Highlight::AddToHighlightRegistry(HighlightRegistry& aHighlightRegistry,
|
||||||
const nsAtom& aHighlightName) {
|
nsAtom& aHighlightName) {
|
||||||
mHighlightRegistries.LookupOrInsert(&aHighlightRegistry)
|
mHighlightRegistries.LookupOrInsert(&aHighlightRegistry)
|
||||||
.Insert(&aHighlightName);
|
.Insert(&aHighlightName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Highlight::RemoveFromHighlightRegistry(
|
void Highlight::RemoveFromHighlightRegistry(
|
||||||
HighlightRegistry& aHighlightRegistry, const nsAtom& aHighlightName) {
|
HighlightRegistry& aHighlightRegistry, nsAtom& aHighlightName) {
|
||||||
if (auto entry = mHighlightRegistries.Lookup(&aHighlightRegistry)) {
|
if (auto entry = mHighlightRegistries.Lookup(&aHighlightRegistry)) {
|
||||||
auto& highlightNames = entry.Data();
|
auto& highlightNames = entry.Data();
|
||||||
highlightNames.Remove(&aHighlightName);
|
highlightNames.Remove(&aHighlightName);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
#include "mozilla/dom/HighlightBinding.h"
|
#include "mozilla/dom/HighlightBinding.h"
|
||||||
|
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsHashKeys.h"
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsTHashSet.h"
|
#include "nsTHashSet.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
|
|
@ -80,13 +80,13 @@ class Highlight final : public nsISupports, public nsWrapperCache {
|
||||||
* the name has to be provided as well.
|
* the name has to be provided as well.
|
||||||
*/
|
*/
|
||||||
void AddToHighlightRegistry(HighlightRegistry& aHighlightRegistry,
|
void AddToHighlightRegistry(HighlightRegistry& aHighlightRegistry,
|
||||||
const nsAtom& aHighlightName);
|
nsAtom& aHighlightName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Removes `this` from `aHighlightRegistry`.
|
* @brief Removes `this` from `aHighlightRegistry`.
|
||||||
*/
|
*/
|
||||||
void RemoveFromHighlightRegistry(HighlightRegistry& aHighlightRegistry,
|
void RemoveFromHighlightRegistry(HighlightRegistry& aHighlightRegistry,
|
||||||
const nsAtom& aHighlightName);
|
nsAtom& aHighlightName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a Highlight Selection using the given ranges.
|
* @brief Creates a Highlight Selection using the given ranges.
|
||||||
|
|
@ -204,8 +204,7 @@ class Highlight final : public nsISupports, public nsWrapperCache {
|
||||||
* Note: Storing `HighlightRegistry` as raw pointer is safe here
|
* Note: Storing `HighlightRegistry` as raw pointer is safe here
|
||||||
* because it unregisters itself from `this` when it is destroyed/CC'd
|
* because it unregisters itself from `this` when it is destroyed/CC'd
|
||||||
*/
|
*/
|
||||||
nsTHashMap<nsPtrHashKey<HighlightRegistry>,
|
nsTHashMap<nsPtrHashKey<HighlightRegistry>, nsTHashSet<RefPtr<nsAtom>>>
|
||||||
nsTHashSet<nsRefPtrHashKey<const nsAtom>>>
|
|
||||||
mHighlightRegistries;
|
mHighlightRegistries;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include "nsAttrValue.h"
|
#include "nsAttrValue.h"
|
||||||
#include "nsAttrValueInlines.h"
|
#include "nsAttrValueInlines.h"
|
||||||
#include "nsAtom.h"
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsUnicharUtils.h"
|
#include "nsUnicharUtils.h"
|
||||||
#include "mozilla/AttributeStyles.h"
|
#include "mozilla/AttributeStyles.h"
|
||||||
#include "mozilla/BloomFilter.h"
|
#include "mozilla/BloomFilter.h"
|
||||||
|
|
@ -53,7 +53,7 @@ struct AtomArrayCache {
|
||||||
// MiscContainer. The MiscContainer removes itself from the cache when
|
// MiscContainer. The MiscContainer removes itself from the cache when
|
||||||
// the last reference to it is dropped, and the atom is kept alive by
|
// the last reference to it is dropped, and the atom is kept alive by
|
||||||
// the MiscContainer.
|
// the MiscContainer.
|
||||||
using MapType = nsTHashMap<nsPtrHashKey<nsAtom>, MiscContainer*>;
|
using MapType = nsTHashMap<nsAtom*, MiscContainer*>;
|
||||||
|
|
||||||
static MiscContainer* Lookup(nsAtom* aValue) {
|
static MiscContainer* Lookup(nsAtom* aValue) {
|
||||||
if (auto* instance = GetInstance()) {
|
if (auto* instance = GetInstance()) {
|
||||||
|
|
@ -822,7 +822,7 @@ UniquePtr<AttrAtomArray> AttrAtomArray::CreateDeduplicatedCopyIfDifferentImpl()
|
||||||
|
|
||||||
bool usingHashTable = false;
|
bool usingHashTable = false;
|
||||||
BitBloomFilter<8, nsAtom> filter;
|
BitBloomFilter<8, nsAtom> filter;
|
||||||
nsTHashSet<nsPtrHashKey<nsAtom>> hash;
|
nsTHashSet<nsAtom*> hash;
|
||||||
|
|
||||||
auto CheckDuplicate = [&](size_t i) {
|
auto CheckDuplicate = [&](size_t i) {
|
||||||
nsAtom* atom = mArray[i];
|
nsAtom* atom = mArray[i];
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "nsIHTMLCollection.h"
|
#include "nsIHTMLCollection.h"
|
||||||
#include "nsINodeList.h"
|
#include "nsINodeList.h"
|
||||||
#include "nsStubMutationObserver.h"
|
#include "nsStubMutationObserver.h"
|
||||||
#include "nsAtom.h"
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsNameSpaceManager.h"
|
#include "nsNameSpaceManager.h"
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
|
|
@ -357,7 +357,7 @@ class nsContentList : public nsBaseContentList,
|
||||||
// A cache from name to the first named item in mElements. Only possibly
|
// A cache from name to the first named item in mElements. Only possibly
|
||||||
// non-null when mState is State::UpToDate. Elements are kept alive by our
|
// non-null when mState is State::UpToDate. Elements are kept alive by our
|
||||||
// mElements array.
|
// mElements array.
|
||||||
using NamedItemsCache = nsTHashMap<RefPtr<nsAtom>, Element*>;
|
using NamedItemsCache = nsTHashMap<nsAtomHashKey, Element*>;
|
||||||
|
|
||||||
void InvalidateNamedItemsCache() {
|
void InvalidateNamedItemsCache() {
|
||||||
mNamedItemsCache = nullptr;
|
mNamedItemsCache = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@
|
||||||
#include "nsAboutProtocolUtils.h"
|
#include "nsAboutProtocolUtils.h"
|
||||||
#include "nsAlgorithm.h"
|
#include "nsAlgorithm.h"
|
||||||
#include "nsArrayUtils.h"
|
#include "nsArrayUtils.h"
|
||||||
#include "nsAtom.h"
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsAttrName.h"
|
#include "nsAttrName.h"
|
||||||
#include "nsAttrValue.h"
|
#include "nsAttrValue.h"
|
||||||
#include "nsAttrValueInlines.h"
|
#include "nsAttrValueInlines.h"
|
||||||
|
|
@ -426,11 +426,10 @@ nsIPrincipal* nsContentUtils::sSystemPrincipal;
|
||||||
nsIPrincipal* nsContentUtils::sNullSubjectPrincipal;
|
nsIPrincipal* nsContentUtils::sNullSubjectPrincipal;
|
||||||
nsIIOService* nsContentUtils::sIOService;
|
nsIIOService* nsContentUtils::sIOService;
|
||||||
nsIConsoleService* nsContentUtils::sConsoleService;
|
nsIConsoleService* nsContentUtils::sConsoleService;
|
||||||
nsTHashMap<nsRefPtrHashKey<nsAtom>, EventNameMapping>*
|
|
||||||
nsContentUtils::sAtomEventTable = nullptr;
|
static nsTHashMap<RefPtr<nsAtom>, EventNameMapping>* sAtomEventTable;
|
||||||
nsTHashMap<nsStringHashKey, EventNameMapping>*
|
static nsTHashMap<nsStringHashKey, EventNameMapping>* sStringEventTable;
|
||||||
nsContentUtils::sStringEventTable = nullptr;
|
static nsTArray<RefPtr<nsAtom>>* sUserDefinedEvents;
|
||||||
nsTArray<RefPtr<nsAtom>>* nsContentUtils::sUserDefinedEvents = nullptr;
|
|
||||||
nsIStringBundleService* nsContentUtils::sStringBundleService;
|
nsIStringBundleService* nsContentUtils::sStringBundleService;
|
||||||
|
|
||||||
static StaticRefPtr<nsIStringBundle>
|
static StaticRefPtr<nsIStringBundle>
|
||||||
|
|
@ -985,8 +984,8 @@ bool nsContentUtils::InitializeEventTable() {
|
||||||
#undef EVENT
|
#undef EVENT
|
||||||
{nullptr}};
|
{nullptr}};
|
||||||
|
|
||||||
sAtomEventTable = new nsTHashMap<nsRefPtrHashKey<nsAtom>, EventNameMapping>(
|
sAtomEventTable =
|
||||||
ArrayLength(eventArray));
|
new nsTHashMap<RefPtr<nsAtom>, EventNameMapping>(ArrayLength(eventArray));
|
||||||
sStringEventTable = new nsTHashMap<nsStringHashKey, EventNameMapping>(
|
sStringEventTable = new nsTHashMap<nsStringHashKey, EventNameMapping>(
|
||||||
ArrayLength(eventArray));
|
ArrayLength(eventArray));
|
||||||
sUserDefinedEvents = new nsTArray<RefPtr<nsAtom>>(64);
|
sUserDefinedEvents = new nsTArray<RefPtr<nsAtom>>(64);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@
|
||||||
#include "mozilla/fallible.h"
|
#include "mozilla/fallible.h"
|
||||||
#include "mozilla/gfx/Point.h"
|
#include "mozilla/gfx/Point.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsHashtablesFwd.h"
|
|
||||||
#include "nsIContentPolicy.h"
|
#include "nsIContentPolicy.h"
|
||||||
#include "nsINode.h"
|
#include "nsINode.h"
|
||||||
#include "nsIScriptError.h"
|
#include "nsIScriptError.h"
|
||||||
|
|
@ -118,7 +117,6 @@ class nsParser;
|
||||||
class nsPIWindowRoot;
|
class nsPIWindowRoot;
|
||||||
class nsPresContext;
|
class nsPresContext;
|
||||||
class nsStringBuffer;
|
class nsStringBuffer;
|
||||||
class nsStringHashKey;
|
|
||||||
class nsTextFragment;
|
class nsTextFragment;
|
||||||
class nsView;
|
class nsView;
|
||||||
class nsWrapperCache;
|
class nsWrapperCache;
|
||||||
|
|
@ -126,9 +124,6 @@ class nsWrapperCache;
|
||||||
struct JSContext;
|
struct JSContext;
|
||||||
struct nsPoint;
|
struct nsPoint;
|
||||||
|
|
||||||
template <class T>
|
|
||||||
class nsRefPtrHashKey;
|
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
class Message;
|
class Message;
|
||||||
class MessageReader;
|
class MessageReader;
|
||||||
|
|
@ -3529,10 +3524,6 @@ class nsContentUtils {
|
||||||
|
|
||||||
static nsIConsoleService* sConsoleService;
|
static nsIConsoleService* sConsoleService;
|
||||||
|
|
||||||
static nsTHashMap<nsRefPtrHashKey<nsAtom>, EventNameMapping>* sAtomEventTable;
|
|
||||||
static nsTHashMap<nsStringHashKey, EventNameMapping>* sStringEventTable;
|
|
||||||
static nsTArray<RefPtr<nsAtom>>* sUserDefinedEvents;
|
|
||||||
|
|
||||||
static nsIStringBundleService* sStringBundleService;
|
static nsIStringBundleService* sStringBundleService;
|
||||||
class nsContentUtilsReporter;
|
class nsContentUtilsReporter;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@
|
||||||
#define nsNameSpaceManager_h___
|
#define nsNameSpaceManager_h___
|
||||||
|
|
||||||
#include "nsTHashMap.h"
|
#include "nsTHashMap.h"
|
||||||
#include "nsHashKeys.h"
|
|
||||||
#include "nsAtom.h"
|
|
||||||
#include "nsStringFwd.h"
|
#include "nsStringFwd.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
|
|
||||||
|
|
@ -73,8 +71,8 @@ class nsNameSpaceManager final {
|
||||||
const int32_t aNameSpaceID);
|
const int32_t aNameSpaceID);
|
||||||
~nsNameSpaceManager() = default;
|
~nsNameSpaceManager() = default;
|
||||||
|
|
||||||
nsTHashMap<nsRefPtrHashKey<nsAtom>, int32_t> mURIToIDTable;
|
nsTHashMap<RefPtr<nsAtom>, int32_t> mURIToIDTable;
|
||||||
nsTHashMap<nsRefPtrHashKey<nsAtom>, int32_t> mDisabledURIToIDTable;
|
nsTHashMap<RefPtr<nsAtom>, int32_t> mDisabledURIToIDTable;
|
||||||
nsTArray<RefPtr<nsAtom>> mURIArray;
|
nsTArray<RefPtr<nsAtom>> mURIArray;
|
||||||
|
|
||||||
static mozilla::StaticRefPtr<nsNameSpaceManager> sInstance;
|
static mozilla::StaticRefPtr<nsNameSpaceManager> sInstance;
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@
|
||||||
#include "base/shared_memory.h"
|
#include "base/shared_memory.h"
|
||||||
#include "mozilla/Omnijar.h"
|
#include "mozilla/Omnijar.h"
|
||||||
#include "nsHashKeys.h"
|
#include "nsHashKeys.h"
|
||||||
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsInterfaceHashtable.h"
|
#include "nsInterfaceHashtable.h"
|
||||||
#include "nsIObserver.h"
|
#include "nsIObserver.h"
|
||||||
#include "nsRefPtrHashtable.h"
|
#include "nsRefPtrHashtable.h"
|
||||||
|
|
||||||
class nsHyphenator;
|
class nsHyphenator;
|
||||||
class nsAtom;
|
class nsAtom;
|
||||||
class nsIURI;
|
class nsIURI;
|
||||||
|
|
@ -45,9 +45,9 @@ class nsHyphenationManager : public nsIObserver {
|
||||||
void LoadPatternListFromDir(nsIFile* aDir);
|
void LoadPatternListFromDir(nsIFile* aDir);
|
||||||
void LoadAliases();
|
void LoadAliases();
|
||||||
|
|
||||||
nsRefPtrHashtable<nsRefPtrHashKey<nsAtom>, nsAtom> mHyphAliases;
|
nsRefPtrHashtable<nsAtomHashKey, nsAtom> mHyphAliases;
|
||||||
nsInterfaceHashtable<nsRefPtrHashKey<nsAtom>, nsIURI> mPatternFiles;
|
nsInterfaceHashtable<nsAtomHashKey, nsIURI> mPatternFiles;
|
||||||
nsRefPtrHashtable<nsRefPtrHashKey<nsAtom>, nsHyphenator> mHyphenators;
|
nsRefPtrHashtable<nsAtomHashKey, nsHyphenator> mHyphenators;
|
||||||
|
|
||||||
static nsHyphenationManager* sInstance;
|
static nsHyphenationManager* sInstance;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include "mozilla/NotNull.h"
|
#include "mozilla/NotNull.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsAtom.h"
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsTHashMap.h"
|
#include "nsTHashMap.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
@ -54,7 +54,7 @@ class nsLanguageAtomService final {
|
||||||
nsStaticAtom* GetUncachedLanguageGroup(nsAtom* aLanguage) const;
|
nsStaticAtom* GetUncachedLanguageGroup(nsAtom* aLanguage) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsTHashMap<nsRefPtrHashKey<nsAtom>, nsStaticAtom*> mLangToGroup;
|
nsTHashMap<RefPtr<nsAtom>, nsStaticAtom*> mLangToGroup;
|
||||||
RefPtr<nsAtom> mLocaleLanguage;
|
RefPtr<nsAtom> mLocaleLanguage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@
|
||||||
#ifndef ContainStyleScopeManager_h_
|
#ifndef ContainStyleScopeManager_h_
|
||||||
#define ContainStyleScopeManager_h_
|
#define ContainStyleScopeManager_h_
|
||||||
|
|
||||||
#include "mozilla/dom/Element.h"
|
#include "nsClassHashtable.h"
|
||||||
#include "nsTHashMap.h"
|
|
||||||
#include "nsTHashSet.h"
|
#include "nsTHashSet.h"
|
||||||
#include "nsQuoteList.h"
|
#include "nsQuoteList.h"
|
||||||
#include "nsCounterManager.h"
|
#include "nsCounterManager.h"
|
||||||
|
|
@ -19,6 +18,10 @@ class nsAtom;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
namespace dom {
|
||||||
|
class Element;
|
||||||
|
}
|
||||||
|
|
||||||
class ContainStyleScopeManager;
|
class ContainStyleScopeManager;
|
||||||
|
|
||||||
/* Implementation of a self-contained `contain: style` scope which manages its
|
/* Implementation of a self-contained `contain: style` scope which manages its
|
||||||
|
|
@ -128,7 +131,7 @@ class ContainStyleScopeManager {
|
||||||
private:
|
private:
|
||||||
ContainStyleScope mRootScope;
|
ContainStyleScope mRootScope;
|
||||||
nsClassHashtable<nsPtrHashKey<nsIContent>, ContainStyleScope> mScopes;
|
nsClassHashtable<nsPtrHashKey<nsIContent>, ContainStyleScope> mScopes;
|
||||||
nsTHashSet<nsRefPtrHashKey<nsAtom>> mDirtyCounters;
|
nsTHashSet<RefPtr<nsAtom>> mDirtyCounters;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ class nsCounterManager {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mozilla::ContainStyleScope* mScope;
|
mozilla::ContainStyleScope* mScope;
|
||||||
nsClassHashtable<nsRefPtrHashKey<nsAtom>, nsCounterList> mNames;
|
nsClassHashtable<nsAtomHashKey, nsCounterList> mNames;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsCounterManager_h_ */
|
#endif /* nsCounterManager_h_ */
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include "mozilla/MathAlgorithms.h"
|
#include "mozilla/MathAlgorithms.h"
|
||||||
#include "mozilla/Maybe.h"
|
#include "mozilla/Maybe.h"
|
||||||
#include "mozilla/HashTable.h"
|
#include "mozilla/HashTable.h"
|
||||||
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsContainerFrame.h"
|
#include "nsContainerFrame.h"
|
||||||
#include "nsILineIterator.h"
|
#include "nsILineIterator.h"
|
||||||
|
|
||||||
|
|
@ -213,21 +214,8 @@ class nsGridContainerFrame final : public nsContainerFrame,
|
||||||
return GetProperty(GridFragmentInfo());
|
return GetProperty(GridFragmentInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AtomKey {
|
using ImplicitNamedAreas =
|
||||||
RefPtr<nsAtom> mKey;
|
mozilla::HashMap<mozilla::AtomHashKey, NamedArea, mozilla::AtomHashKey>;
|
||||||
|
|
||||||
explicit AtomKey(nsAtom* aAtom) : mKey(aAtom) {}
|
|
||||||
|
|
||||||
using Lookup = nsAtom*;
|
|
||||||
|
|
||||||
static mozilla::HashNumber hash(const Lookup& aKey) { return aKey->hash(); }
|
|
||||||
|
|
||||||
static bool match(const AtomKey& aFirst, const Lookup& aSecond) {
|
|
||||||
return aFirst.mKey == aSecond;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
using ImplicitNamedAreas = mozilla::HashMap<AtomKey, NamedArea, AtomKey>;
|
|
||||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(ImplicitNamedAreasProperty,
|
NS_DECLARE_FRAME_PROPERTY_DELETABLE(ImplicitNamedAreasProperty,
|
||||||
ImplicitNamedAreas)
|
ImplicitNamedAreas)
|
||||||
ImplicitNamedAreas* GetImplicitNamedAreas() const {
|
ImplicitNamedAreas* GetImplicitNamedAreas() const {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include "mozilla/ComputedStyle.h"
|
#include "mozilla/ComputedStyle.h"
|
||||||
#include "mozilla/Span.h"
|
#include "mozilla/Span.h"
|
||||||
|
|
||||||
#include "nsAtom.h"
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsISelectionController.h"
|
#include "nsISelectionController.h"
|
||||||
#include "nsTHashMap.h"
|
#include "nsTHashMap.h"
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ class MOZ_STACK_CLASS nsTextPaintStyle {
|
||||||
nscolor mSelectionTextColor;
|
nscolor mSelectionTextColor;
|
||||||
nscolor mSelectionBGColor;
|
nscolor mSelectionBGColor;
|
||||||
RefPtr<ComputedStyle> mSelectionPseudoStyle;
|
RefPtr<ComputedStyle> mSelectionPseudoStyle;
|
||||||
nsTHashMap<RefPtr<const nsAtom>, RefPtr<ComputedStyle>>
|
nsTHashMap<RefPtr<nsAtom>, RefPtr<ComputedStyle>>
|
||||||
mCustomHighlightPseudoStyles;
|
mCustomHighlightPseudoStyles;
|
||||||
|
|
||||||
// Common data
|
// Common data
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
#ifndef mozilla_CounterStyleManager_h_
|
#ifndef mozilla_CounterStyleManager_h_
|
||||||
#define mozilla_CounterStyleManager_h_
|
#define mozilla_CounterStyleManager_h_
|
||||||
|
|
||||||
#include "nsAtom.h"
|
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsStringFwd.h"
|
#include "nsStringFwd.h"
|
||||||
#include "nsTHashMap.h"
|
#include "nsTHashMap.h"
|
||||||
|
|
@ -347,7 +346,7 @@ class CounterStyleManager final {
|
||||||
void DestroyCounterStyle(CounterStyle* aCounterStyle);
|
void DestroyCounterStyle(CounterStyle* aCounterStyle);
|
||||||
|
|
||||||
nsPresContext* mPresContext;
|
nsPresContext* mPresContext;
|
||||||
nsTHashMap<nsRefPtrHashKey<nsAtom>, CounterStyle*> mStyles;
|
nsTHashMap<RefPtr<nsAtom>, CounterStyle*> mStyles;
|
||||||
nsTArray<CounterStyle*> mRetiredStyles;
|
nsTArray<CounterStyle*> mRetiredStyles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#ifndef mozilla_ShadowParts_h
|
#ifndef mozilla_ShadowParts_h
|
||||||
#define mozilla_ShadowParts_h
|
#define mozilla_ShadowParts_h
|
||||||
|
|
||||||
#include "nsAtom.h"
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsTHashtable.h"
|
#include "nsTHashtable.h"
|
||||||
#include "nsClassHashtable.h"
|
#include "nsClassHashtable.h"
|
||||||
#include "nsRefPtrHashtable.h"
|
#include "nsRefPtrHashtable.h"
|
||||||
|
|
@ -38,8 +38,8 @@ class ShadowParts final {
|
||||||
|
|
||||||
// TODO(emilio): If the two hashtables take a lot of memory we should consider
|
// TODO(emilio): If the two hashtables take a lot of memory we should consider
|
||||||
// just using an nsTArray<Pair<>> or something.
|
// just using an nsTArray<Pair<>> or something.
|
||||||
nsClassHashtable<nsRefPtrHashKey<nsAtom>, PartList> mMappings;
|
nsClassHashtable<nsAtomHashKey, PartList> mMappings;
|
||||||
nsRefPtrHashtable<nsRefPtrHashKey<nsAtom>, nsAtom> mReverseMappings;
|
nsRefPtrHashtable<nsAtomHashKey, nsAtom> mReverseMappings;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include "mozilla/LinkedList.h"
|
#include "mozilla/LinkedList.h"
|
||||||
#include "mozilla/Maybe.h"
|
#include "mozilla/Maybe.h"
|
||||||
#include "mozilla/RefPtr.h"
|
#include "mozilla/RefPtr.h"
|
||||||
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsTHashMap.h"
|
#include "nsTHashMap.h"
|
||||||
|
|
||||||
class nsAtom;
|
class nsAtom;
|
||||||
|
|
@ -28,8 +29,7 @@ class TimelineCollection final
|
||||||
: public LinkedListElement<TimelineCollection<TimelineType>> {
|
: public LinkedListElement<TimelineCollection<TimelineType>> {
|
||||||
public:
|
public:
|
||||||
using SelfType = TimelineCollection<TimelineType>;
|
using SelfType = TimelineCollection<TimelineType>;
|
||||||
using TimelineMap =
|
using TimelineMap = nsTHashMap<RefPtr<nsAtom>, RefPtr<TimelineType>>;
|
||||||
nsTHashMap<nsRefPtrHashKey<const nsAtom>, RefPtr<TimelineType>>;
|
|
||||||
|
|
||||||
TimelineCollection(dom::Element& aElement, PseudoStyleType aPseudoType)
|
TimelineCollection(dom::Element& aElement, PseudoStyleType aPseudoType)
|
||||||
: mElement(aElement), mPseudo(aPseudoType) {
|
: mElement(aElement), mPseudo(aPseudoType) {
|
||||||
|
|
@ -38,11 +38,11 @@ class TimelineCollection final
|
||||||
|
|
||||||
~TimelineCollection();
|
~TimelineCollection();
|
||||||
|
|
||||||
already_AddRefed<TimelineType> Lookup(const nsAtom* aName) const {
|
already_AddRefed<TimelineType> Lookup(nsAtom* aName) const {
|
||||||
return mTimelines.Get(aName).forget();
|
return mTimelines.Get(aName).forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<TimelineType> Extract(const nsAtom* aName) {
|
already_AddRefed<TimelineType> Extract(nsAtom* aName) {
|
||||||
Maybe<RefPtr<TimelineType>> timeline = mTimelines.Extract(aName);
|
Maybe<RefPtr<TimelineType>> timeline = mTimelines.Extract(aName);
|
||||||
return timeline ? timeline->forget() : nullptr;
|
return timeline ? timeline->forget() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ void TimelineManager::UpdateTimelines(Element* aElement,
|
||||||
|
|
||||||
template <typename TimelineType>
|
template <typename TimelineType>
|
||||||
static already_AddRefed<TimelineType> PopExistingTimeline(
|
static already_AddRefed<TimelineType> PopExistingTimeline(
|
||||||
const nsAtom* aName, TimelineCollection<TimelineType>* aCollection) {
|
nsAtom* aName, TimelineCollection<TimelineType>* aCollection) {
|
||||||
if (!aCollection) {
|
if (!aCollection) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ static void UpdateOldAnimationPropertiesWithNew(
|
||||||
|
|
||||||
static already_AddRefed<dom::AnimationTimeline> GetNamedProgressTimeline(
|
static already_AddRefed<dom::AnimationTimeline> GetNamedProgressTimeline(
|
||||||
dom::Document* aDocument, const NonOwningAnimationTarget& aTarget,
|
dom::Document* aDocument, const NonOwningAnimationTarget& aTarget,
|
||||||
const nsAtom* aName) {
|
nsAtom* aName) {
|
||||||
// A named progress timeline is referenceable in animation-timeline by:
|
// A named progress timeline is referenceable in animation-timeline by:
|
||||||
// 1. the declaring element itself
|
// 1. the declaring element itself
|
||||||
// 2. that element’s descendants
|
// 2. that element’s descendants
|
||||||
|
|
@ -259,7 +259,7 @@ static already_AddRefed<dom::AnimationTimeline> GetTimeline(
|
||||||
switch (aStyleTimeline.tag) {
|
switch (aStyleTimeline.tag) {
|
||||||
case StyleAnimationTimeline::Tag::Timeline: {
|
case StyleAnimationTimeline::Tag::Timeline: {
|
||||||
// Check scroll-timeline-name property or view-timeline-property.
|
// Check scroll-timeline-name property or view-timeline-property.
|
||||||
const nsAtom* name = aStyleTimeline.AsTimeline().AsAtom();
|
nsAtom* name = aStyleTimeline.AsTimeline().AsAtom();
|
||||||
return name != nsGkAtoms::_empty
|
return name != nsGkAtoms::_empty
|
||||||
? GetNamedProgressTimeline(aPresContext->Document(), aTarget,
|
? GetNamedProgressTimeline(aPresContext->Document(), aTarget,
|
||||||
name)
|
name)
|
||||||
|
|
|
||||||
|
|
@ -1196,7 +1196,7 @@ struct StyleScrollTimeline {
|
||||||
// elements.
|
// elements.
|
||||||
void SetInitialValues() {}
|
void SetInitialValues() {}
|
||||||
|
|
||||||
const nsAtom* GetName() const { return mName._0.AsAtom(); }
|
nsAtom* GetName() const { return mName._0.AsAtom(); }
|
||||||
StyleScrollAxis GetAxis() const { return mAxis; }
|
StyleScrollAxis GetAxis() const { return mAxis; }
|
||||||
|
|
||||||
bool operator==(const StyleScrollTimeline& aOther) const {
|
bool operator==(const StyleScrollTimeline& aOther) const {
|
||||||
|
|
@ -1220,7 +1220,7 @@ struct StyleViewTimeline {
|
||||||
// elements.
|
// elements.
|
||||||
void SetInitialValues() {}
|
void SetInitialValues() {}
|
||||||
|
|
||||||
const nsAtom* GetName() const { return mName._0.AsAtom(); }
|
nsAtom* GetName() const { return mName._0.AsAtom(); }
|
||||||
StyleScrollAxis GetAxis() const { return mAxis; }
|
StyleScrollAxis GetAxis() const { return mAxis; }
|
||||||
const StyleViewTimelineInset& GetInset() const { return mInset; }
|
const StyleViewTimelineInset& GetInset() const { return mInset; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef nsHTMLTags_h___
|
#ifndef nsHTMLTags_h___
|
||||||
#define nsHTMLTags_h___
|
#define nsHTMLTags_h___
|
||||||
|
|
||||||
#include "nsAtom.h"
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsTHashMap.h"
|
#include "nsTHashMap.h"
|
||||||
#include "nsHashKeys.h"
|
#include "nsHashKeys.h"
|
||||||
|
|
@ -42,7 +42,8 @@ enum nsHTMLTag {
|
||||||
class nsHTMLTags {
|
class nsHTMLTags {
|
||||||
public:
|
public:
|
||||||
using TagStringHash = nsTHashMap<nsStringHashKey, nsHTMLTag>;
|
using TagStringHash = nsTHashMap<nsStringHashKey, nsHTMLTag>;
|
||||||
using TagAtomHash = nsTHashMap<nsPtrHashKey<nsAtom>, nsHTMLTag>;
|
// Can be weak, because we know these are always static, see AddRefTable.
|
||||||
|
using TagAtomHash = nsTHashMap<nsAtom*, nsHTMLTag>;
|
||||||
|
|
||||||
static nsresult AddRefTable(void);
|
static nsresult AddRefTable(void);
|
||||||
static void ReleaseTable(void);
|
static void ReleaseTable(void);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#include "nsPointerHashKeys.h"
|
#include "nsPointerHashKeys.h"
|
||||||
#include "nsRefPtrHashtable.h"
|
#include "nsRefPtrHashtable.h"
|
||||||
#include "nsTHashSet.h"
|
#include "nsTHashSet.h"
|
||||||
|
#include "nsAtomHashKeys.h"
|
||||||
|
|
||||||
class nsIChannel;
|
class nsIChannel;
|
||||||
class nsIObserverService;
|
class nsIObserverService;
|
||||||
|
|
@ -74,7 +75,7 @@ class ExtensionPolicyService final : public nsIAddonPolicyService,
|
||||||
static RefPtr<extensions::WebExtensionPolicyCore> GetCoreByHost(
|
static RefPtr<extensions::WebExtensionPolicyCore> GetCoreByHost(
|
||||||
const nsACString& aHost);
|
const nsACString& aHost);
|
||||||
|
|
||||||
WebExtensionPolicy* GetByID(const nsAtom* aAddonId) {
|
WebExtensionPolicy* GetByID(nsAtom* aAddonId) {
|
||||||
return mExtensions.GetWeak(aAddonId);
|
return mExtensions.GetWeak(aAddonId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,7 +127,8 @@ class ExtensionPolicyService final : public nsIAddonPolicyService,
|
||||||
void UpdateRestrictedDomains();
|
void UpdateRestrictedDomains();
|
||||||
void UpdateQuarantinedDomains();
|
void UpdateQuarantinedDomains();
|
||||||
|
|
||||||
nsRefPtrHashtable<nsPtrHashKey<const nsAtom>, WebExtensionPolicy> mExtensions;
|
// The WebExtensionPolicy object keeps the key alive.
|
||||||
|
nsRefPtrHashtable<nsWeakAtomHashKey, WebExtensionPolicy> mExtensions;
|
||||||
|
|
||||||
nsRefPtrHashtable<nsPtrHashKey<const extensions::DocumentObserver>,
|
nsRefPtrHashtable<nsPtrHashKey<const extensions::DocumentObserver>,
|
||||||
extensions::DocumentObserver>
|
extensions::DocumentObserver>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#include "mozilla/WeakPtr.h"
|
#include "mozilla/WeakPtr.h"
|
||||||
|
|
||||||
#include "mozilla/DOMEventTargetHelper.h"
|
#include "mozilla/DOMEventTargetHelper.h"
|
||||||
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsIChannel.h"
|
#include "nsIChannel.h"
|
||||||
|
|
@ -29,7 +30,6 @@
|
||||||
#include "nsIStreamListener.h"
|
#include "nsIStreamListener.h"
|
||||||
#include "nsIRemoteTab.h"
|
#include "nsIRemoteTab.h"
|
||||||
#include "nsIThreadRetargetableStreamListener.h"
|
#include "nsIThreadRetargetableStreamListener.h"
|
||||||
#include "nsPointerHashKeys.h"
|
|
||||||
#include "nsInterfaceHashtable.h"
|
#include "nsInterfaceHashtable.h"
|
||||||
#include "nsIWeakReferenceUtils.h"
|
#include "nsIWeakReferenceUtils.h"
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
|
|
@ -320,7 +320,7 @@ class ChannelWrapper final : public DOMEventTargetHelper,
|
||||||
bool mSuspended = false;
|
bool mSuspended = false;
|
||||||
bool mResponseStarted = false;
|
bool mResponseStarted = false;
|
||||||
|
|
||||||
nsInterfaceHashtable<nsPtrHashKey<const nsAtom>, nsIRemoteTab> mAddonEntries;
|
nsInterfaceHashtable<nsAtomHashKey, nsIRemoteTab> mAddonEntries;
|
||||||
|
|
||||||
// The text for the "Extension Suspend" marker, set from the Suspend method
|
// The text for the "Extension Suspend" marker, set from the Suspend method
|
||||||
// when called for the first time and then cleared on the Resume method.
|
// when called for the first time and then cleared on the Resume method.
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ EXPORTS += [
|
||||||
"nsArrayEnumerator.h",
|
"nsArrayEnumerator.h",
|
||||||
"nsArrayUtils.h",
|
"nsArrayUtils.h",
|
||||||
"nsAtom.h",
|
"nsAtom.h",
|
||||||
|
"nsAtomHashKeys.h",
|
||||||
"nsBaseHashtable.h",
|
"nsBaseHashtable.h",
|
||||||
"nsCharSeparatedTokenizer.h",
|
"nsCharSeparatedTokenizer.h",
|
||||||
"nsCheapSets.h",
|
"nsCheapSets.h",
|
||||||
|
|
|
||||||
51
xpcom/ds/nsAtomHashKeys.h
Normal file
51
xpcom/ds/nsAtomHashKeys.h
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
/* Definitions for nsAtom-related hash keys */
|
||||||
|
|
||||||
|
#ifndef nsAtomHashKeys_h
|
||||||
|
#define nsAtomHashKeys_h
|
||||||
|
|
||||||
|
#include "nsAtom.h"
|
||||||
|
#include "nsHashKeys.h"
|
||||||
|
|
||||||
|
// TODO(emilio): Consider removing this and specializing AddToHash instead
|
||||||
|
// once bug 1849386 is fixed.
|
||||||
|
|
||||||
|
// Hash keys suitable for use in nsTHashTable.
|
||||||
|
struct nsAtomHashKey : public nsRefPtrHashKey<nsAtom> {
|
||||||
|
using nsRefPtrHashKey::nsRefPtrHashKey;
|
||||||
|
static PLDHashNumber HashKey(KeyTypePointer aKey) {
|
||||||
|
return MOZ_LIKELY(aKey) ? aKey->hash() : 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct nsWeakAtomHashKey : public nsPtrHashKey<nsAtom> {
|
||||||
|
using nsPtrHashKey::nsPtrHashKey;
|
||||||
|
static PLDHashNumber HashKey(KeyTypePointer aKey) {
|
||||||
|
return nsAtomHashKey::HashKey(aKey);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Hash keys suitable for use in mozilla::HashMap.
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
struct AtomHashKey {
|
||||||
|
RefPtr<nsAtom> mKey;
|
||||||
|
|
||||||
|
explicit AtomHashKey(nsAtom* aAtom) : mKey(aAtom) {}
|
||||||
|
|
||||||
|
using Lookup = nsAtom*;
|
||||||
|
|
||||||
|
static HashNumber hash(const Lookup& aKey) { return aKey->hash(); }
|
||||||
|
static bool match(const AtomHashKey& aFirst, const Lookup& aSecond) {
|
||||||
|
return aFirst.mKey == aSecond;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif // nsAtomHashKeys_h
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include "nsBaseHashtable.h"
|
#include "nsBaseHashtable.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsHashKeys.h"
|
#include "nsHashKeys.h"
|
||||||
|
#include "nsAtomHashKeys.h"
|
||||||
#include "nsHashtablesFwd.h"
|
#include "nsHashtablesFwd.h"
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
|
@ -29,6 +30,11 @@ struct nsKeyClass<KeyType*> {
|
||||||
using type = nsPtrHashKey<KeyType>;
|
using type = nsPtrHashKey<KeyType>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct nsKeyClass<nsAtom*> {
|
||||||
|
using type = nsWeakAtomHashKey;
|
||||||
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct nsKeyClass<nsCString> {
|
struct nsKeyClass<nsCString> {
|
||||||
using type = nsCStringHashKey;
|
using type = nsCStringHashKey;
|
||||||
|
|
@ -57,6 +63,11 @@ struct nsKeyClass<RefPtr<T>> {
|
||||||
using type = nsRefPtrHashKey<T>;
|
using type = nsRefPtrHashKey<T>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct nsKeyClass<RefPtr<nsAtom>> {
|
||||||
|
using type = nsAtomHashKey;
|
||||||
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct nsKeyClass<nsID> {
|
struct nsKeyClass<nsID> {
|
||||||
using type = nsIDHashKey;
|
using type = nsIDHashKey;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue