Changeset 277382 in webkit
- Timestamp:
- May 12, 2021, 11:40:38 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r277379 r277382 1 2021-05-12 Alex Christensen <achristensen@webkit.org> 2 3 Use HashSet<RefPtr<Node>> instead of HashSet<Node*> 4 https://bugs.webkit.org/show_bug.cgi?id=220464 5 6 Reviewed by Chris Dumez and Ryosuke Niwa. 7 8 This makes us more resistent to lifetime bugs. 9 10 liveNodeSet() and ignoreSet() need to be WeakHashSet, and they are only used in debug builds so that's fine. 11 12 MutationObserver::observedNodes() is not called on the main thread, but it's called during garbage collection. 13 I replaced it with MutationObserver::isReachableFromOpaqueRoots which eliminates the HashSet allocation and hashing, 14 and it can return true early if it finds a contained opaque root, resulting in less work in several ways. 15 This should only increase our performance slightly while getting the same behavior. 16 17 * accessibility/AXObjectCache.cpp: 18 (WebCore::conditionallyAddNodeToFilterList): 19 (WebCore::filterVectorPairForRemoval): 20 (WebCore::filterMapForRemoval): 21 (WebCore::filterListForRemoval): 22 (WebCore::AXObjectCache::prepareForDocumentDestruction): 23 * bindings/js/JSMutationObserverCustom.cpp: 24 (WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots): 25 * dom/MutationObserver.cpp: 26 (WebCore::MutationObserver::isReachableFromOpaqueRoots const): 27 (WebCore:: const): Deleted. 28 * dom/MutationObserver.h: 29 * dom/MutationObserverRegistration.cpp: 30 (WebCore::MutationObserverRegistration::isReachableFromOpaqueRoots const): 31 (WebCore::MutationObserverRegistration::addRegistrationNodesToSet const): Deleted. 32 * dom/MutationObserverRegistration.h: 33 * dom/Node.cpp: 34 (WebCore::liveNodeSet): 35 (WebCore::stringForRareDataUseType): 36 (WebCore::Node::dumpStatistics): 37 (WebCore::ignoreSet): 38 (WebCore::Node::trackForDebugging): 39 (WebCore::Node::~Node): 40 * editing/AppendNodeCommand.cpp: 41 (WebCore::AppendNodeCommand::getNodesInCommand): 42 * editing/AppendNodeCommand.h: 43 * editing/CompositeEditCommand.cpp: 44 (WebCore::EditCommandComposition::getNodesInCommand): 45 * editing/CompositeEditCommand.h: 46 * editing/DeleteFromTextNodeCommand.cpp: 47 (WebCore::DeleteFromTextNodeCommand::getNodesInCommand): 48 * editing/DeleteFromTextNodeCommand.h: 49 * editing/EditCommand.cpp: 50 (WebCore::SimpleEditCommand::addNodeAndDescendants): 51 * editing/EditCommand.h: 52 * editing/InsertIntoTextNodeCommand.cpp: 53 (WebCore::InsertIntoTextNodeCommand::getNodesInCommand): 54 * editing/InsertIntoTextNodeCommand.h: 55 * editing/InsertNodeBeforeCommand.cpp: 56 (WebCore::InsertNodeBeforeCommand::getNodesInCommand): 57 * editing/InsertNodeBeforeCommand.h: 58 * editing/MergeIdenticalElementsCommand.cpp: 59 (WebCore::MergeIdenticalElementsCommand::getNodesInCommand): 60 * editing/MergeIdenticalElementsCommand.h: 61 * editing/RemoveNodeCommand.cpp: 62 (WebCore::RemoveNodeCommand::getNodesInCommand): 63 * editing/RemoveNodeCommand.h: 64 * editing/ReplaceNodeWithSpanCommand.cpp: 65 (WebCore::ReplaceNodeWithSpanCommand::getNodesInCommand): 66 * editing/ReplaceNodeWithSpanCommand.h: 67 * editing/SetNodeAttributeCommand.cpp: 68 (WebCore::SetNodeAttributeCommand::getNodesInCommand): 69 * editing/SetNodeAttributeCommand.h: 70 * editing/SetSelectionCommand.h: 71 * editing/SpellingCorrectionCommand.cpp: 72 * editing/SplitElementCommand.cpp: 73 (WebCore::SplitElementCommand::getNodesInCommand): 74 * editing/SplitElementCommand.h: 75 * editing/SplitTextNodeCommand.cpp: 76 (WebCore::SplitTextNodeCommand::getNodesInCommand): 77 * editing/SplitTextNodeCommand.h: 78 * editing/WrapContentsInDummySpanCommand.cpp: 79 (WebCore::WrapContentsInDummySpanCommand::getNodesInCommand): 80 * editing/WrapContentsInDummySpanCommand.h: 81 * editing/cocoa/HTMLConverter.mm: 82 (HTMLConverterCaches::cacheAncestorsOfStartToBeConverted): 83 * inspector/agents/InspectorDOMAgent.cpp: 84 (WebCore::InspectorDOMAgent::highlightSelector): 85 * xml/XPathFunctions.cpp: 86 (WebCore::XPath::FunId::evaluate const): 87 * xml/XPathNodeSet.cpp: 88 (WebCore::XPath::sortBlock): 89 (WebCore::XPath::NodeSet::traversalSort const): 90 * xml/XPathPath.cpp: 91 (WebCore::XPath::LocationPath::evaluate const): 92 * xml/XPathPredicate.cpp: 93 (WebCore::XPath::Union::evaluate const): 94 1 95 2021-05-12 Jer Noble <jer.noble@apple.com> 2 96 -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r277307 r277382 3081 3081 } 3082 3082 3083 static void conditionallyAddNodeToFilterList(Node* node, const Document& document, HashSet< Node*>& nodesToRemove)3083 static void conditionallyAddNodeToFilterList(Node* node, const Document& document, HashSet<Ref<Node>>& nodesToRemove) 3084 3084 { 3085 3085 if (node && (!node->isConnected() || &node->document() == &document)) 3086 nodesToRemove.add( node);3086 nodesToRemove.add(*node); 3087 3087 } 3088 3088 3089 3089 template<typename T> 3090 static void filterVectorPairForRemoval(const Vector<std::pair<T, T>>& list, const Document& document, HashSet< Node*>& nodesToRemove)3090 static void filterVectorPairForRemoval(const Vector<std::pair<T, T>>& list, const Document& document, HashSet<Ref<Node>>& nodesToRemove) 3091 3091 { 3092 3092 for (auto& entry : list) { … … 3097 3097 3098 3098 template<typename T, typename U> 3099 static void filterMapForRemoval(const HashMap<T, U>& list, const Document& document, HashSet< Node*>& nodesToRemove)3099 static void filterMapForRemoval(const HashMap<T, U>& list, const Document& document, HashSet<Ref<Node>>& nodesToRemove) 3100 3100 { 3101 3101 for (auto& entry : list) … … 3104 3104 3105 3105 template<typename T> 3106 static void filterListForRemoval(const ListHashSet<T>& list, const Document& document, HashSet< Node*>& nodesToRemove)3106 static void filterListForRemoval(const ListHashSet<T>& list, const Document& document, HashSet<Ref<Node>>& nodesToRemove) 3107 3107 { 3108 3108 for (auto* node : list) … … 3112 3112 void AXObjectCache::prepareForDocumentDestruction(const Document& document) 3113 3113 { 3114 HashSet< Node*> nodesToRemove;3114 HashSet<Ref<Node>> nodesToRemove; 3115 3115 filterListForRemoval(m_textMarkerNodes, document, nodesToRemove); 3116 3116 filterListForRemoval(m_modalElementsSet, document, nodesToRemove); … … 3121 3121 filterVectorPairForRemoval(m_deferredFocusedNodeChange, document, nodesToRemove); 3122 3122 3123 for (auto *node : nodesToRemove)3124 remove( *node);3123 for (auto& node : nodesToRemove) 3124 remove(node); 3125 3125 } 3126 3126 -
trunk/Source/WebCore/bindings/js/JSMutationObserverCustom.cpp
r277307 r277382 50 50 bool JSMutationObserverOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char**reason) 51 51 { 52 for (auto* node : jsCast<JSMutationObserver*>(handle.slot()->asCell())->wrapped().observedNodes()) { 53 if (visitor.containsOpaqueRoot(root(node))) { 54 if (UNLIKELY(reason)) 55 *reason = "Reachable from observed nodes"; 56 return true; 57 } 52 if (jsCast<JSMutationObserver*>(handle.slot()->asCell())->wrapped().isReachableFromOpaqueRoots(visitor)) { 53 if (UNLIKELY(reason)) 54 *reason = "Reachable from observed nodes"; 55 return true; 58 56 } 59 57 return false; -
trunk/Source/WebCore/dom/MutationObserver.cpp
r277307 r277382 170 170 } 171 171 172 HashSet<Node*> MutationObserver::observedNodes() const 173 { 174 HashSet<Node*> observedNodes; 175 for (auto* registration : m_registrations) 176 registration->addRegistrationNodesToSet(observedNodes); 177 return observedNodes; 172 bool MutationObserver::isReachableFromOpaqueRoots(JSC::AbstractSlotVisitor& visitor) const 173 { 174 for (auto* registration : m_registrations) { 175 if (registration->isReachableFromOpaqueRoots(visitor)) 176 return true; 177 } 178 return false; 178 179 } 179 180 -
trunk/Source/WebCore/dom/MutationObserver.h
r277307 r277382 38 38 #include <wtf/IsoMalloc.h> 39 39 #include <wtf/Vector.h> 40 41 namespace JSC { 42 class AbstractSlotVisitor; 43 } 40 44 41 45 namespace WebCore { … … 102 106 bool canDeliver(); 103 107 104 HashSet<Node*> observedNodes() const;108 bool isReachableFromOpaqueRoots(JSC::AbstractSlotVisitor&) const; 105 109 106 110 MutationCallback& callback() const { return m_callback.get(); } -
trunk/Source/WebCore/dom/MutationObserverRegistration.cpp
r277307 r277382 34 34 35 35 #include "Document.h" 36 #include "JSNodeCustom.h" 36 37 #include "QualifiedName.h" 37 38 … … 113 114 } 114 115 115 void MutationObserverRegistration::addRegistrationNodesToSet(HashSet<Node*>& nodes) const116 bool MutationObserverRegistration::isReachableFromOpaqueRoots(JSC::AbstractSlotVisitor& visitor) const 116 117 { 117 nodes.add(&m_node); 118 if (visitor.containsOpaqueRoot(root(m_node))) 119 return true; 120 118 121 if (!m_transientRegistrationNodes) 119 return; 120 for (auto& node : *m_transientRegistrationNodes) 121 nodes.add(node.ptr()); 122 return false; 123 124 for (auto& node : *m_transientRegistrationNodes) { 125 if (visitor.containsOpaqueRoot(root(node))) 126 return true; 127 } 128 129 return false; 122 130 } 123 131 -
trunk/Source/WebCore/dom/MutationObserverRegistration.h
r277307 r277382 37 37 #include <wtf/text/AtomStringHash.h> 38 38 39 namespace JSC { 40 class AbstractSlotVisitor; 41 } 42 39 43 namespace WebCore { 40 44 … … 60 64 MutationObserverOptions mutationTypes() const { return m_options & MutationObserver::AllMutationTypes; } 61 65 62 void addRegistrationNodesToSet(HashSet<Node*>&) const;66 bool isReachableFromOpaqueRoots(JSC::AbstractSlotVisitor&) const; 63 67 64 68 private: -
trunk/Source/WebCore/dom/Node.cpp
r277307 r277382 96 96 97 97 #if DUMP_NODE_STATISTICS 98 static HashSet<Node*>& liveNodeSet()99 { 100 static NeverDestroyed< HashSet<Node*>> liveNodes;98 static WeakHashSet<Node>& liveNodeSet() 99 { 100 static NeverDestroyed<WeakHashSet<Node>> liveNodes; 101 101 return liveNodes; 102 102 } … … 105 105 { 106 106 switch (useType) { 107 case NodeRareData::UseType::ConnectedFrameCount:108 return "ConnectedFrameCount";109 107 case NodeRareData::UseType::NodeList: 110 108 return "NodeList"; … … 176 174 size_t mixedRareDataUseCount = 0; 177 175 178 for (auto *node : liveNodeSet()) {179 if (node ->hasRareData()) {176 for (auto& node : liveNodeSet()) { 177 if (node.hasRareData()) { 180 178 ++nodesWithRareData; 181 if (is<Element>( *node)) {179 if (is<Element>(node)) { 182 180 ++elementsWithRareData; 183 if (downcast<Element>( *node).hasNamedNodeMap())181 if (downcast<Element>(node).hasNamedNodeMap()) 184 182 ++elementsWithNamedNodeMap; 185 183 } 186 auto* rareData = node ->rareData();184 auto* rareData = node.rareData(); 187 185 auto useTypes = is<Element>(node) ? static_cast<ElementRareData*>(rareData)->useTypes() : rareData->useTypes(); 188 186 unsigned useTypeCount = 0; … … 198 196 } 199 197 200 switch (node ->nodeType()) {198 switch (node.nodeType()) { 201 199 case ELEMENT_NODE: { 202 200 ++elementNodes; 203 201 204 202 // Tag stats 205 Element& element = downcast<Element>( *node);203 Element& element = downcast<Element>(node); 206 204 HashMap<String, size_t>::AddResult result = perTagCount.add(element.tagName(), 1); 207 205 if (!result.isNewEntry) … … 249 247 } 250 248 case DOCUMENT_FRAGMENT_NODE: { 251 if (node ->isShadowRoot())249 if (node.isShadowRoot()) 252 250 ++shadowRootNodes; 253 251 else … … 258 256 } 259 257 260 printf("Number of Nodes: %d\n\n", liveNodeSet(). size());258 printf("Number of Nodes: %d\n\n", liveNodeSet().computeSize()); 261 259 printf("Number of Nodes with RareData: %zu\n", nodesWithRareData); 262 260 printf(" Mixed use: %zu\n", mixedRareDataUseCount); … … 296 294 static bool shouldIgnoreLeaks = false; 297 295 298 static HashSet<Node*>& ignoreSet() 299 { 300 static NeverDestroyed<HashSet<Node*>> ignore; 301 296 static WeakHashSet<Node>& ignoreSet() 297 { 298 static NeverDestroyed<WeakHashSet<Node>> ignore; 302 299 return ignore; 303 300 } … … 323 320 #ifndef NDEBUG 324 321 if (shouldIgnoreLeaks) 325 ignoreSet().add( this);322 ignoreSet().add(*this); 326 323 else 327 324 nodeCounter.increment(); … … 329 326 330 327 #if DUMP_NODE_STATISTICS 331 liveNodeSet().add( this);328 liveNodeSet().add(*this); 332 329 #endif 333 330 } … … 354 351 355 352 #ifndef NDEBUG 356 if (!ignoreSet().remove( this))353 if (!ignoreSet().remove(*this)) 357 354 nodeCounter.decrement(); 358 355 #endif 359 356 360 357 #if DUMP_NODE_STATISTICS 361 liveNodeSet().remove( this);358 liveNodeSet().remove(*this); 362 359 #endif 363 360 -
trunk/Source/WebCore/editing/AppendNodeCommand.cpp
r277307 r277382 62 62 63 63 #ifndef NDEBUG 64 void AppendNodeCommand::getNodesInCommand(HashSet< Node*>& nodes)64 void AppendNodeCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 65 65 { 66 66 addNodeAndDescendants(m_parent.ptr(), nodes); -
trunk/Source/WebCore/editing/AppendNodeCommand.h
r277307 r277382 44 44 45 45 #ifndef NDEBUG 46 void getNodesInCommand(HashSet< Node*>&) override;46 void getNodesInCommand(HashSet<Ref<Node>>&) override; 47 47 #endif 48 48 -
trunk/Source/WebCore/editing/CompositeEditCommand.cpp
r277307 r277382 320 320 321 321 #ifndef NDEBUG 322 void EditCommandComposition::getNodesInCommand(HashSet< Node*>& nodes)322 void EditCommandComposition::getNodesInCommand(HashSet<Ref<Node>>& nodes) 323 323 { 324 324 for (auto& command : m_commands) -
trunk/Source/WebCore/editing/CompositeEditCommand.h
r277307 r277382 85 85 86 86 #ifndef NDEBUG 87 virtual void getNodesInCommand(HashSet< Node*>&);87 virtual void getNodesInCommand(HashSet<Ref<Node>>&); 88 88 #endif 89 89 -
trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp
r277307 r277382 65 65 66 66 #ifndef NDEBUG 67 void DeleteFromTextNodeCommand::getNodesInCommand(HashSet< Node*>& nodes)67 void DeleteFromTextNodeCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 68 68 { 69 69 addNodeAndDescendants(m_node.ptr(), nodes); -
trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h
r277307 r277382 47 47 48 48 #ifndef NDEBUG 49 void getNodesInCommand(HashSet< Node*>&) override;49 void getNodesInCommand(HashSet<Ref<Node>>&) override; 50 50 #endif 51 51 -
trunk/Source/WebCore/editing/EditCommand.cpp
r277307 r277382 217 217 218 218 #ifndef NDEBUG 219 void SimpleEditCommand::addNodeAndDescendants(Node* startNode, HashSet< Node*>& nodes)219 void SimpleEditCommand::addNodeAndDescendants(Node* startNode, HashSet<Ref<Node>>& nodes) 220 220 { 221 221 for (Node* node = startNode; node; node = NodeTraversal::next(*node, startNode)) 222 nodes.add( node);222 nodes.add(*node); 223 223 } 224 224 #endif -
trunk/Source/WebCore/editing/EditCommand.h
r277307 r277382 95 95 96 96 #ifndef NDEBUG 97 virtual void getNodesInCommand(HashSet< Node*>&) = 0;97 virtual void getNodesInCommand(HashSet<Ref<Node>>&) = 0; 98 98 #endif 99 99 … … 102 102 103 103 #ifndef NDEBUG 104 void addNodeAndDescendants(Node*, HashSet< Node*>&);104 void addNodeAndDescendants(Node*, HashSet<Ref<Node>>&); 105 105 #endif 106 106 -
trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp
r277307 r277382 88 88 #ifndef NDEBUG 89 89 90 void InsertIntoTextNodeCommand::getNodesInCommand(HashSet< Node*>& nodes)90 void InsertIntoTextNodeCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 91 91 { 92 92 addNodeAndDescendants(m_node.ptr(), nodes); -
trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.h
r277307 r277382 50 50 51 51 #ifndef NDEBUG 52 void getNodesInCommand(HashSet< Node*>&) override;52 void getNodesInCommand(HashSet<Ref<Node>>&) override; 53 53 #endif 54 54 -
trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp
r277307 r277382 66 66 67 67 #ifndef NDEBUG 68 void InsertNodeBeforeCommand::getNodesInCommand(HashSet< Node*>& nodes)68 void InsertNodeBeforeCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 69 69 { 70 70 addNodeAndDescendants(m_insertChild.ptr(), nodes); -
trunk/Source/WebCore/editing/InsertNodeBeforeCommand.h
r277307 r277382 46 46 47 47 #ifndef NDEBUG 48 void getNodesInCommand(HashSet< Node*>&) override;48 void getNodesInCommand(HashSet<Ref<Node>>&) override; 49 49 #endif 50 50 -
trunk/Source/WebCore/editing/MergeIdenticalElementsCommand.cpp
r277307 r277382 76 76 77 77 #ifndef NDEBUG 78 void MergeIdenticalElementsCommand::getNodesInCommand(HashSet< Node*>& nodes)78 void MergeIdenticalElementsCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 79 79 { 80 80 addNodeAndDescendants(m_element1.ptr(), nodes); -
trunk/Source/WebCore/editing/MergeIdenticalElementsCommand.h
r277307 r277382 44 44 45 45 #ifndef NDEBUG 46 void getNodesInCommand(HashSet< Node*>&) override;46 void getNodesInCommand(HashSet<Ref<Node>>&) override; 47 47 #endif 48 48 -
trunk/Source/WebCore/editing/RemoveNodeCommand.cpp
r277307 r277382 67 67 68 68 #ifndef NDEBUG 69 void RemoveNodeCommand::getNodesInCommand(HashSet< Node*>& nodes)69 void RemoveNodeCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 70 70 { 71 71 addNodeAndDescendants(m_parent.get(), nodes); -
trunk/Source/WebCore/editing/RemoveNodeCommand.h
r277307 r277382 44 44 45 45 #ifndef NDEBUG 46 void getNodesInCommand(HashSet< Node*>&) override;46 void getNodesInCommand(HashSet<Ref<Node>>&) override; 47 47 #endif 48 48 -
trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp
r277307 r277382 75 75 76 76 #ifndef NDEBUG 77 void ReplaceNodeWithSpanCommand::getNodesInCommand(HashSet< Node*>& nodes)77 void ReplaceNodeWithSpanCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 78 78 { 79 79 addNodeAndDescendants(m_elementToReplace.ptr(), nodes); -
trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.h
r277307 r277382 54 54 55 55 #ifndef NDEBUG 56 void getNodesInCommand(HashSet< Node*>&) override;56 void getNodesInCommand(HashSet<Ref<Node>>&) override; 57 57 #endif 58 58 -
trunk/Source/WebCore/editing/SetNodeAttributeCommand.cpp
r277307 r277382 55 55 56 56 #ifndef NDEBUG 57 void SetNodeAttributeCommand::getNodesInCommand(HashSet< Node*>& nodes)57 void SetNodeAttributeCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 58 58 { 59 59 addNodeAndDescendants(m_element.ptr(), nodes); -
trunk/Source/WebCore/editing/SetNodeAttributeCommand.h
r277307 r277382 45 45 46 46 #ifndef NDEBUG 47 void getNodesInCommand(HashSet< Node*>&) override;47 void getNodesInCommand(HashSet<Ref<Node>>&) override; 48 48 #endif 49 49 -
trunk/Source/WebCore/editing/SetSelectionCommand.h
r277307 r277382 45 45 46 46 #ifndef NDEBUG 47 void getNodesInCommand(HashSet< Node*>&) override { }47 void getNodesInCommand(HashSet<Ref<Node>>&) override { } 48 48 #endif 49 49 -
trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp
r277307 r277382 73 73 74 74 #ifndef NDEBUG 75 void getNodesInCommand(HashSet< Node*>&) override75 void getNodesInCommand(HashSet<Ref<Node>>&) override 76 76 { 77 77 } -
trunk/Source/WebCore/editing/SplitElementCommand.cpp
r277307 r277382 102 102 103 103 #ifndef NDEBUG 104 void SplitElementCommand::getNodesInCommand(HashSet< Node*>& nodes)104 void SplitElementCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 105 105 { 106 106 addNodeAndDescendants(m_element1.get(), nodes); -
trunk/Source/WebCore/editing/SplitElementCommand.h
r277307 r277382 46 46 47 47 #ifndef NDEBUG 48 void getNodesInCommand(HashSet< Node*>&) override;48 void getNodesInCommand(HashSet<Ref<Node>>&) override; 49 49 #endif 50 50 -
trunk/Source/WebCore/editing/SplitTextNodeCommand.cpp
r277307 r277382 105 105 #ifndef NDEBUG 106 106 107 void SplitTextNodeCommand::getNodesInCommand(HashSet< Node*>& nodes)107 void SplitTextNodeCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 108 108 { 109 109 addNodeAndDescendants(m_text1.get(), nodes); -
trunk/Source/WebCore/editing/SplitTextNodeCommand.h
r277307 r277382 48 48 49 49 #ifndef NDEBUG 50 void getNodesInCommand(HashSet< Node*>&) override;50 void getNodesInCommand(HashSet<Ref<Node>>&) override; 51 51 #endif 52 52 -
trunk/Source/WebCore/editing/WrapContentsInDummySpanCommand.cpp
r277307 r277382 80 80 81 81 #ifndef NDEBUG 82 void WrapContentsInDummySpanCommand::getNodesInCommand(HashSet< Node*>& nodes)82 void WrapContentsInDummySpanCommand::getNodesInCommand(HashSet<Ref<Node>>& nodes) 83 83 { 84 84 addNodeAndDescendants(m_element.ptr(), nodes); -
trunk/Source/WebCore/editing/WrapContentsInDummySpanCommand.h
r277307 r277382 48 48 49 49 #ifndef NDEBUG 50 void getNodesInCommand(HashSet< Node*>&) override;50 void getNodesInCommand(HashSet<Ref<Node>>&) override; 51 51 #endif 52 52 -
trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm
r277307 r277382 263 263 private: 264 264 HashMap<Element*, std::unique_ptr<ComputedStyleExtractor>> m_computedStyles; 265 HashSet< Node*> m_ancestorsUnderCommonAncestor;265 HashSet<Ref<Node>> m_ancestorsUnderCommonAncestor; 266 266 }; 267 267 … … 2285 2285 2286 2286 while (ancestor) { 2287 m_ancestorsUnderCommonAncestor.add( ancestor);2287 m_ancestorsUnderCommonAncestor.add(*ancestor); 2288 2288 if (ancestor == commonAncestor) 2289 2289 break; -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
r277307 r277382 1337 1337 1338 1338 Vector<Ref<Node>> nodeList; 1339 HashSet< Node*> seenNodes;1339 HashSet<Ref<Node>> seenNodes; 1340 1340 1341 1341 for (auto& descendant : composedTreeDescendants(*document)) { … … 1357 1357 1358 1358 if (selectorChecker.match(*selector, descendantElement, context)) { 1359 if (seenNodes.add( &descendantElement))1359 if (seenNodes.add(descendantElement)) 1360 1360 nodeList.append(descendantElement); 1361 1361 } … … 1367 1367 pseudoIDs.remove(PseudoId::Before); 1368 1368 if (auto* beforePseudoElement = descendantElement.beforePseudoElement()) { 1369 if (seenNodes.add( beforePseudoElement))1369 if (seenNodes.add(*beforePseudoElement)) 1370 1370 nodeList.append(*beforePseudoElement); 1371 1371 } … … 1375 1375 pseudoIDs.remove(PseudoId::After); 1376 1376 if (auto* afterPseudoElement = descendantElement.afterPseudoElement()) { 1377 if (seenNodes.add( afterPseudoElement))1377 if (seenNodes.add(*afterPseudoElement)) 1378 1378 nodeList.append(*afterPseudoElement); 1379 1379 } … … 1381 1381 1382 1382 if (pseudoIDs) { 1383 if (seenNodes.add( &descendantElement))1383 if (seenNodes.add(descendantElement)) 1384 1384 nodeList.append(descendantElement); 1385 1385 } -
trunk/Source/WebCore/xml/XPathFunctions.cpp
r277307 r277382 330 330 TreeScope& contextScope = evaluationContext().node->treeScope(); 331 331 NodeSet result; 332 HashSet< Node*> resultSet;332 HashSet<Ref<Node>> resultSet; 333 333 334 334 unsigned startPos = 0; … … 348 348 // In WebKit, getElementById behaves so, too, although its behavior in this case is formally undefined. 349 349 Node* node = contextScope.getElementById(toStringView(idList).substring(startPos, endPos - startPos)); 350 if (node && resultSet.add( node).isNewEntry)350 if (node && resultSet.add(*node).isNewEntry) 351 351 result.append(node); 352 352 -
trunk/Source/WebCore/xml/XPathNodeSet.cpp
r277307 r277382 108 108 // Children nodes of the common ancestor induce a subdivision of our node-set. 109 109 // Sort it according to this subdivision, and recursively sort each group. 110 HashSet< Node*> parentNodes;110 HashSet<RefPtr<Node>> parentNodes; 111 111 for (unsigned i = from; i < to; ++i) 112 112 parentNodes.add(parentWithDepth(commonAncestorDepth + 1, parentMatrix[i])); … … 193 193 void NodeSet::traversalSort() const 194 194 { 195 HashSet< Node*> nodes;195 HashSet<RefPtr<Node>> nodes; 196 196 bool containsAttributeNodes = false; 197 197 -
trunk/Source/WebCore/xml/XPathPath.cpp
r277307 r277382 106 106 for (auto& step : m_steps) { 107 107 NodeSet newNodes; 108 HashSet< Node*> newNodesSet;108 HashSet<RefPtr<Node>> newNodesSet; 109 109 110 110 bool needToCheckForDuplicateNodes = !nodes.subtreesAreDisjoint() || (step->axis() != Step::ChildAxis && step->axis() != Step::SelfAxis -
trunk/Source/WebCore/xml/XPathPredicate.cpp
r277307 r277382 242 242 const NodeSet& rhsNodes = rhs.toNodeSet(); 243 243 244 HashSet< Node*> nodes;244 HashSet<RefPtr<Node>> nodes; 245 245 for (auto& result : resultSet) 246 246 nodes.add(result.get());
Note:
See TracChangeset
for help on using the changeset viewer.