Diff
Modified: trunk/Source/WTF/ChangeLog (279438 => 279439)
--- trunk/Source/WTF/ChangeLog 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WTF/ChangeLog 2021-06-30 22:51:21 UTC (rev 279439)
@@ -1,3 +1,22 @@
+2021-06-30 Ryosuke Niwa <[email protected]>
+
+ Use WeakHashMap and WeakPtr with Node in more places
+ https://bugs.webkit.org/show_bug.cgi?id=227192
+ <rdar://problem/79828322>
+
+ Reviewed by Geoffrey Garen.
+
+ * wtf/WeakHashMap.h:
+ (WTF::WeakHashMap::WeakHashMapIteratorBase::makePeek): Fixed type mismatch errors.
+ (WTF::WeakHashMap::ensure): Made this function return AddResult like HashMap::ensure.
+ (WTF::WeakHashMap::take): Added.
+ (WTF::WeakHashMap::removeIf): Fixed the bug that the callback was called with the iterator
+ of m_impl and not WeakHashMapIterator.
+ * wtf/WeakHashSet.h:
+ (WTF::HashTraits<Ref<WeakPtrImpl<Counter>>>::isReleasedWeakValue): Moved to WeakPtr.h
+ * wtf/WeakPtr.h:
+ (WTF::HashTraits<Ref<WeakPtrImpl<Counter>>>::isReleasedWeakValue): Moved from WeakHashSet.h
+
2021-06-30 Truitt Savell <[email protected]>
Unreviewed, reverting r279405.
Modified: trunk/Source/WTF/wtf/WeakHashMap.h (279438 => 279439)
--- trunk/Source/WTF/wtf/WeakHashMap.h 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WTF/wtf/WeakHashMap.h 2021-06-30 22:51:21 UTC (rev 279439)
@@ -93,7 +93,7 @@
ALWAYS_INLINE IteratorPeekType makePeek()
{
auto* entry = m_position.get();
- KeyType* key = entry->key->template get<KeyType>();
+ auto* key = static_cast<KeyType*>(entry->key->template get<KeyType>());
return IteratorPeekType { *key, entry->value };
}
@@ -100,7 +100,7 @@
ALWAYS_INLINE IteratorPeekType makePeek() const
{
auto* entry = m_position.get();
- KeyType* key = entry->key->template get<KeyType>();
+ auto* key = static_cast<KeyType*>(entry->key->template get<KeyType>());
return IteratorPeekType { *key, const_cast<ValueType&>(entry->value) };
}
@@ -194,7 +194,13 @@
const_iterator begin() const { return WeakHashMapConstIterator(*this, m_map.begin()); }
const_iterator end() const { return WeakHashMapConstIterator(*this, m_map.end()); }
- template <typename Functor> void ensure(const KeyType& key, Functor&& functor) { return m_map.ensure(key, functor); }
+ template <typename Functor>
+ AddResult ensure(const KeyType& key, Functor&& functor)
+ {
+ amortizedCleanupIfNeeded();
+ auto result = m_map.ensure(makeKeyImpl(key), functor);
+ return AddResult { WeakHashMapIterator(*this, result.iterator), result.isNewEntry };
+ }
template<typename T>
AddResult add(const KeyType& key, T&& value)
@@ -238,6 +244,15 @@
return m_map.contains(*keyImpl);
}
+ typename ValueTraits::TakeType take(const KeyType& key)
+ {
+ amortizedCleanupIfNeeded();
+ auto* keyImpl = keyImplIfExists(key);
+ if (!keyImpl)
+ return ValueTraits::take(ValueTraits::emptyValue());
+ return m_map.take(*keyImpl);
+ }
+
typename ValueTraits::PeekType get(const KeyType& key)
{
amortizedCleanupIfNeeded();
@@ -266,11 +281,13 @@
bool removeIf(Functor&& functor)
{
m_operationCountSinceLastCleanup = 0;
- return m_map.removeIf([&](auto& iterator) {
- bool isReleasedWeakKey = !iterator.key.get();
+ return m_map.removeIf([&](auto& entry) {
+ auto* key = static_cast<KeyType*>(entry.key->template get<KeyType>());
+ bool isReleasedWeakKey = !key;
if (isReleasedWeakKey)
return true;
- return functor(iterator);
+ PeekType peek { *key, entry.value };
+ return functor(peek);
});
}
Modified: trunk/Source/WTF/wtf/WeakHashSet.h (279438 => 279439)
--- trunk/Source/WTF/wtf/WeakHashSet.h 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WTF/wtf/WeakHashSet.h 2021-06-30 22:51:21 UTC (rev 279439)
@@ -31,14 +31,6 @@
namespace WTF {
-template<typename Counter> struct HashTraits<Ref<WeakPtrImpl<Counter>>> : RefHashTraits<WeakPtrImpl<Counter>> {
- static constexpr bool hasIsReleasedWeakValueFunction = true;
- static bool isReleasedWeakValue(const Ref<WeakPtrImpl<Counter>>& value)
- {
- return !value.isHashTableDeletedValue() && !value.isHashTableEmptyValue() && !value.get();
- }
-};
-
template<typename T, typename Counter = EmptyCounter>
class WeakHashSet final {
WTF_MAKE_FAST_ALLOCATED;
Modified: trunk/Source/WTF/wtf/WeakPtr.h (279438 => 279439)
--- trunk/Source/WTF/wtf/WeakPtr.h 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WTF/wtf/WeakPtr.h 2021-06-30 22:51:21 UTC (rev 279439)
@@ -26,6 +26,7 @@
#pragma once
+#include <wtf/HashTraits.h>
#include <wtf/Threading.h>
namespace WTF {
@@ -82,6 +83,14 @@
#endif
};
+template<typename Counter> struct HashTraits<Ref<WeakPtrImpl<Counter>>> : RefHashTraits<WeakPtrImpl<Counter>> {
+ static constexpr bool hasIsReleasedWeakValueFunction = true;
+ static bool isReleasedWeakValue(const Ref<WeakPtrImpl<Counter>>& value)
+ {
+ return !value.isHashTableDeletedValue() && !value.isHashTableEmptyValue() && !value.get();
+ }
+};
+
template<typename T, typename Counter> class WeakPtr {
WTF_MAKE_FAST_ALLOCATED;
public:
Modified: trunk/Source/WebCore/ChangeLog (279438 => 279439)
--- trunk/Source/WebCore/ChangeLog 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/ChangeLog 2021-06-30 22:51:21 UTC (rev 279439)
@@ -1,3 +1,44 @@
+2021-06-30 Ryosuke Niwa <[email protected]>
+
+ Use WeakHashMap and WeakPtr with Node in more places
+ https://bugs.webkit.org/show_bug.cgi?id=227192
+ <rdar://problem/79828322>
+
+ Reviewed by Geoffrey Garen.
+
+ Deploy WeakHashMap and WeakPtr with Node/Element in more places.
+
+ * dom/Document.cpp:
+ (WebCore::Document::elementForAccessKey):
+ (WebCore::Document::buildAccessKeyCache):
+ (WebCore::Document::registerForVisibilityStateChangedCallbacks):
+ (WebCore::Document::unregisterForVisibilityStateChangedCallbacks):
+ (WebCore::Document::visibilityStateChanged):
+ * dom/Document.h:
+ * dom/VisibilityChangeClient.h:
+ * html/FormController.cpp:
+ (WebCore::FormKeyGenerator::formKey):
+ (WebCore::FormKeyGenerator::willDeleteForm):
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::rootEditableElementMap):
+ (WebCore::HTMLAnchorElement::rootEditableElementForSelectionOnMouseDown const):
+ (WebCore::HTMLAnchorElement::clearRootEditableElementForSelectionOnMouseDown):
+ (WebCore::HTMLAnchorElement::setRootEditableElementForSelectionOnMouseDown):
+ * inspector/agents/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::bind):
+ (WebCore::InspectorDOMAgent::unbind):
+ (WebCore::InspectorDOMAgent::nodeForId):
+ (WebCore::InspectorDOMAgent::pushNodePathToFrontend):
+ (WebCore::InspectorDOMAgent::boundNodeId):
+ (WebCore::InspectorDOMAgent::willDestroyDOMNode):
+ (WebCore::InspectorDOMAgent::mediaMetricsTimerFired):
+ * inspector/agents/InspectorDOMAgent.h:
+ * inspector/agents/InspectorLayerTreeAgent.cpp:
+ (WebCore::InspectorLayerTreeAgent::bindPseudoElement):
+ (WebCore::InspectorLayerTreeAgent::unbindPseudoElement):
+ * inspector/agents/InspectorLayerTreeAgent.h:
+ * style/StyleSharingResolver.h:
+
2021-06-30 venky dass <[email protected]>
Updated to use smart pointers in MutationObserver.
Modified: trunk/Source/WebCore/dom/Document.cpp (279438 => 279439)
--- trunk/Source/WebCore/dom/Document.cpp 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/dom/Document.cpp 2021-06-30 22:51:21 UTC (rev 279439)
@@ -879,13 +879,13 @@
return nullptr;
if (!m_accessKeyCache)
buildAccessKeyCache();
- return m_accessKeyCache->get(key);
+ return m_accessKeyCache->get(key).get();
}
void Document::buildAccessKeyCache()
{
- m_accessKeyCache = makeUnique<HashMap<String, Element*, ASCIICaseInsensitiveHash>>([this] {
- HashMap<String, Element*, ASCIICaseInsensitiveHash> map;
+ m_accessKeyCache = makeUnique<HashMap<String, WeakPtr<Element>, ASCIICaseInsensitiveHash>>([this] {
+ HashMap<String, WeakPtr<Element>, ASCIICaseInsensitiveHash> map;
for (auto& node : composedTreeDescendants(*this)) {
if (!is<Element>(node))
continue;
@@ -893,7 +893,7 @@
auto& key = element.attributeWithoutSynchronization(accesskeyAttr);
if (key.isEmpty())
continue;
- map.add(key, &element);
+ map.add(key, makeWeakPtr(element));
}
return map;
}());
@@ -1826,12 +1826,12 @@
void Document::registerForVisibilityStateChangedCallbacks(VisibilityChangeClient& client)
{
- m_visibilityStateCallbackClients.add(&client);
+ m_visibilityStateCallbackClients.add(client);
}
void Document::unregisterForVisibilityStateChangedCallbacks(VisibilityChangeClient& client)
{
- m_visibilityStateCallbackClients.remove(&client);
+ m_visibilityStateCallbackClients.remove(client);
}
void Document::visibilityStateChanged()
@@ -1838,8 +1838,8 @@
{
// https://w3c.github.io/page-visibility/#reacting-to-visibilitychange-changes
queueTaskToDispatchEvent(TaskSource::UserInteraction, Event::create(eventNames().visibilitychangeEvent, Event::CanBubble::Yes, Event::IsCancelable::No));
- for (auto* client : m_visibilityStateCallbackClients)
- client->visibilityStateChanged();
+ for (auto& client : m_visibilityStateCallbackClients)
+ client.visibilityStateChanged();
#if ENABLE(MEDIA_STREAM) && PLATFORM(IOS_FAMILY)
if (auto mediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists()) {
Modified: trunk/Source/WebCore/dom/Document.h (279438 => 279439)
--- trunk/Source/WebCore/dom/Document.h 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/dom/Document.h 2021-06-30 22:51:21 UTC (rev 279439)
@@ -1874,9 +1874,9 @@
WeakPtr<Element> m_mainArticleElement;
WeakHashSet<Element> m_articleElements;
- HashSet<VisibilityChangeClient*> m_visibilityStateCallbackClients;
+ WeakHashSet<VisibilityChangeClient> m_visibilityStateCallbackClients;
- std::unique_ptr<HashMap<String, Element*, ASCIICaseInsensitiveHash>> m_accessKeyCache;
+ std::unique_ptr<HashMap<String, WeakPtr<Element>, ASCIICaseInsensitiveHash>> m_accessKeyCache;
std::unique_ptr<ConstantPropertyMap> m_constantPropertyMap;
Modified: trunk/Source/WebCore/dom/VisibilityChangeClient.h (279438 => 279439)
--- trunk/Source/WebCore/dom/VisibilityChangeClient.h 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/dom/VisibilityChangeClient.h 2021-06-30 22:51:21 UTC (rev 279439)
@@ -27,7 +27,7 @@
namespace WebCore {
-class VisibilityChangeClient {
+class VisibilityChangeClient : public CanMakeWeakPtr<VisibilityChangeClient> {
public:
virtual ~VisibilityChangeClient() = default;
Modified: trunk/Source/WebCore/html/FormController.cpp (279438 => 279439)
--- trunk/Source/WebCore/html/FormController.cpp 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/html/FormController.cpp 2021-06-30 22:51:21 UTC (rev 279439)
@@ -25,6 +25,7 @@
#include "HTMLInputElement.h"
#include "ScriptDisallowedScope.h"
#include <wtf/NeverDestroyed.h>
+#include <wtf/WeakHashMap.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/text/StringConcatenateNumbers.h>
#include <wtf/text/StringToIntegerConversion.h>
@@ -272,10 +273,8 @@
void willDeleteForm(HTMLFormElement*);
private:
- typedef HashMap<HTMLFormElement*, AtomString> FormToKeyMap;
- typedef HashMap<String, unsigned> FormSignatureToNextIndexMap;
- FormToKeyMap m_formToKeyMap;
- FormSignatureToNextIndexMap m_formSignatureToNextIndexMap;
+ WeakHashMap<HTMLFormElement, AtomString> m_formToKeyMap;
+ HashMap<String, unsigned> m_formSignatureToNextIndexMap;
};
static inline void recordFormStructure(const HTMLFormElement& form, StringBuilder& builder)
@@ -323,7 +322,7 @@
return formKeyForNoOwner;
}
- return m_formToKeyMap.ensure(form.get(), [this, &form] {
+ return m_formToKeyMap.ensure(*form, [this, &form] {
auto signature = formSignature(*form);
auto nextIndex = m_formSignatureToNextIndexMap.add(signature, 0).iterator->value++;
// FIXME: Would be nice to have makeAtomString to use to optimize the case where the string already exists.
@@ -333,8 +332,8 @@
void FormKeyGenerator::willDeleteForm(HTMLFormElement* form)
{
- ASSERT(form);
- m_formToKeyMap.remove(form);
+ RELEASE_ASSERT(form);
+ m_formToKeyMap.remove(*form);
}
// ----------------------------------------------------------------------------
Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (279438 => 279439)
--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2021-06-30 22:51:21 UTC (rev 279439)
@@ -55,6 +55,7 @@
#include "Settings.h"
#include "UserGestureIndicator.h"
#include <wtf/IsoMallocInlines.h>
+#include <wtf/WeakHashMap.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/text/StringConcatenateNumbers.h>
@@ -589,12 +590,10 @@
return isLink() || HTMLElement::willRespondToMouseClickEvents();
}
-typedef HashMap<const HTMLAnchorElement*, RefPtr<Element>> RootEditableElementMap;
-
-static RootEditableElementMap& rootEditableElementMap()
+static auto& rootEditableElementMap()
{
- static NeverDestroyed<RootEditableElementMap> map;
- return map;
+ static NeverDestroyed<WeakHashMap<HTMLAnchorElement, WeakPtr<Element>>> map;
+ return map.get();
}
Element* HTMLAnchorElement::rootEditableElementForSelectionOnMouseDown() const
@@ -601,7 +600,7 @@
{
if (!m_hasRootEditableElementForSelectionOnMouseDown)
return 0;
- return rootEditableElementMap().get(this);
+ return rootEditableElementMap().get(*this).get();
}
void HTMLAnchorElement::clearRootEditableElementForSelectionOnMouseDown()
@@ -608,7 +607,7 @@
{
if (!m_hasRootEditableElementForSelectionOnMouseDown)
return;
- rootEditableElementMap().remove(this);
+ rootEditableElementMap().remove(*this);
m_hasRootEditableElementForSelectionOnMouseDown = false;
}
@@ -619,7 +618,7 @@
return;
}
- rootEditableElementMap().set(this, element);
+ rootEditableElementMap().set(*this, makeWeakPtr(element));
m_hasRootEditableElementForSelectionOnMouseDown = true;
}
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (279438 => 279439)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2021-06-30 22:51:21 UTC (rev 279439)
@@ -380,9 +380,9 @@
Protocol::DOM::NodeId InspectorDOMAgent::bind(Node& node)
{
- return m_nodeToId.ensure(&node, [&] {
+ return m_nodeToId.ensure(node, [&] {
auto id = m_lastNodeId++;
- m_idToNode.set(id, &node);
+ m_idToNode.set(id, makeWeakPtr(node));
return id;
}).iterator->value;
}
@@ -389,7 +389,7 @@
void InspectorDOMAgent::unbind(Node& node)
{
- auto id = m_nodeToId.take(&node);
+ auto id = m_nodeToId.take(node);
if (!id)
return;
@@ -566,7 +566,7 @@
if (!m_idToNode.isValidKey(id))
return nullptr;
- return m_idToNode.get(id);
+ return m_idToNode.get(id).get();
}
Protocol::ErrorStringOr<void> InspectorDOMAgent::requestChildNodes(Protocol::DOM::NodeId nodeId, std::optional<int>&& depth)
@@ -646,7 +646,7 @@
}
// FIXME: <https://webkit.org/b/213499> Web Inspector: allow DOM nodes to be instrumented at any point, regardless of whether the main document has also been instrumented
- if (!m_nodeToId.contains(m_document.get())) {
+ if (!m_nodeToId.contains(*m_document)) {
errorString = "Document must have been requested"_s;
return 0;
}
@@ -684,10 +684,10 @@
Protocol::DOM::NodeId InspectorDOMAgent::boundNodeId(const Node* node)
{
- if (!m_nodeToId.isValidKey(node))
+ if (!node)
return 0;
- return m_nodeToId.get(node);
+ return m_nodeToId.get(*node);
}
Protocol::ErrorStringOr<void> InspectorDOMAgent::setAttributeValue(Protocol::DOM::NodeId nodeId, const String& name, const String& value)
@@ -2466,7 +2466,7 @@
if (containsOnlyHTMLWhitespace(&node))
return;
- auto nodeId = m_nodeToId.take(&node);
+ auto nodeId = m_nodeToId.take(node);
if (!nodeId)
return;
@@ -2753,9 +2753,9 @@
auto videoPlaybackQuality = mediaElement->getVideoPlaybackQuality();
unsigned displayCompositedVideoFrames = videoPlaybackQuality->displayCompositedVideoFrames();
- auto iterator = m_mediaMetrics.find(mediaElement);
+ auto iterator = m_mediaMetrics.find(*mediaElement);
if (iterator == m_mediaMetrics.end()) {
- m_mediaMetrics.set(mediaElement, MediaMetrics(displayCompositedVideoFrames));
+ m_mediaMetrics.set(*mediaElement, MediaMetrics(displayCompositedVideoFrames));
continue;
}
@@ -2773,7 +2773,7 @@
}
m_mediaMetrics.removeIf([&] (auto& entry) {
- return !HTMLMediaElement::allMediaElements().contains(entry.key);
+ return !HTMLMediaElement::allMediaElements().contains(&entry.key);
});
}
#endif
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h (279438 => 279439)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h 2021-06-30 22:51:21 UTC (rev 279439)
@@ -41,6 +41,7 @@
#include <wtf/JSONValues.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
+#include <wtf/WeakHashMap.h>
#include <wtf/text/AtomString.h>
namespace Inspector {
@@ -248,8 +249,8 @@
RefPtr<Inspector::DOMBackendDispatcher> m_backendDispatcher;
Page& m_inspectedPage;
InspectorOverlay* m_overlay { nullptr };
- HashMap<const Node*, Inspector::Protocol::DOM::NodeId> m_nodeToId;
- HashMap<Inspector::Protocol::DOM::NodeId, Node*> m_idToNode;
+ WeakHashMap<Node, Inspector::Protocol::DOM::NodeId> m_nodeToId;
+ HashMap<Inspector::Protocol::DOM::NodeId, WeakPtr<Node>> m_idToNode;
HashSet<Inspector::Protocol::DOM::NodeId> m_childrenRequested;
Inspector::Protocol::DOM::NodeId m_lastNodeId { 1 };
RefPtr<Document> m_document;
@@ -282,7 +283,7 @@
};
// The pointer key for this map should not be used for anything other than matching.
- HashMap<HTMLMediaElement*, MediaMetrics> m_mediaMetrics;
+ WeakHashMap<HTMLMediaElement, MediaMetrics> m_mediaMetrics;
#endif
struct InspectorEventListener {
Modified: trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp (279438 => 279439)
--- trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp 2021-06-30 22:51:21 UTC (rev 279439)
@@ -351,9 +351,9 @@
{
if (!pseudoElement)
return emptyString();
- return m_pseudoElementToIdMap.ensure(pseudoElement, [this, pseudoElement] {
+ return m_pseudoElementToIdMap.ensure(*pseudoElement, [this, pseudoElement] {
auto identifier = IdentifiersFactory::createIdentifier();
- m_idToPseudoElement.set(identifier, pseudoElement);
+ m_idToPseudoElement.set(identifier, makeWeakPtr(pseudoElement));
return identifier;
}).iterator->value;
}
@@ -360,7 +360,9 @@
void InspectorLayerTreeAgent::unbindPseudoElement(PseudoElement* pseudoElement)
{
- auto identifier = m_pseudoElementToIdMap.take(pseudoElement);
+ if (!pseudoElement)
+ return;
+ auto identifier = m_pseudoElementToIdMap.take(*pseudoElement);
if (identifier.isNull())
return;
m_idToPseudoElement.remove(identifier);
Modified: trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.h (279438 => 279439)
--- trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.h 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.h 2021-06-30 22:51:21 UTC (rev 279439)
@@ -32,6 +32,7 @@
#include <_javascript_Core/InspectorBackendDispatchers.h>
#include <_javascript_Core/InspectorFrontendDispatchers.h>
#include <_javascript_Core/InspectorProtocolObjects.h>
+#include <wtf/WeakHashMap.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -87,8 +88,8 @@
HashMap<const RenderLayer*, Inspector::Protocol::LayerTree::LayerId> m_documentLayerToIdMap;
HashMap<Inspector::Protocol::LayerTree::LayerId, const RenderLayer*> m_idToLayer;
- HashMap<PseudoElement*, Inspector::Protocol::LayerTree::PseudoElementId> m_pseudoElementToIdMap;
- HashMap<Inspector::Protocol::LayerTree::PseudoElementId, PseudoElement*> m_idToPseudoElement;
+ WeakHashMap<PseudoElement, Inspector::Protocol::LayerTree::PseudoElementId> m_pseudoElementToIdMap;
+ HashMap<Inspector::Protocol::LayerTree::PseudoElementId, WeakPtr<PseudoElement>> m_idToPseudoElement;
bool m_suppressLayerChangeEvents { false };
};
Modified: trunk/Source/WebCore/style/StyleSharingResolver.h (279438 => 279439)
--- trunk/Source/WebCore/style/StyleSharingResolver.h 2021-06-30 22:34:29 UTC (rev 279438)
+++ trunk/Source/WebCore/style/StyleSharingResolver.h 2021-06-30 22:51:21 UTC (rev 279439)
@@ -64,6 +64,7 @@
const ScopeRuleSets& m_ruleSets;
const SelectorFilter& m_selectorFilter;
+ // FIXME: Use WeakHashMap or HashMap<CheckedPtr, CheckedPtr>.
HashMap<const Element*, const Element*> m_elementsSharingStyle;
};