Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(815)

Unified Diff: Source/core/dom/NodeRareData.cpp

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make NodeListsNodeData::m_owner a strong ref Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/NodeRareData.cpp
diff --git a/Source/core/dom/NodeRareData.cpp b/Source/core/dom/NodeRareData.cpp
index c29894c2a00a5f2807675c7d17679ae65a955043..a347406ea4fee114bd1888840e92a84bd99935df 100644
--- a/Source/core/dom/NodeRareData.cpp
+++ b/Source/core/dom/NodeRareData.cpp
@@ -58,9 +58,33 @@ void NodeListsNodeData::invalidateCaches(const QualifiedName* attrName)
it->value->invalidateCache();
}
+#if ENABLE(OILPAN)
+void NodeListsNodeData::clearWeakMembers(Visitor* visitor)
+{
+ if (m_childNodeList && !visitor->isAlive(m_childNodeList))
haraken 2014/05/20 09:27:33 Nit: You don't need to check m_childNodeList.
+ m_childNodeList.clear();
+ if (!m_childNodeList && !m_atomicNameCaches.size() && !m_tagCollectionCacheNS.size())
+ m_owner->clearNodeLists();
+}
+#endif
+
+void NodeListsNodeData::trace(Visitor* visitor)
+{
+#if ENABLE(OILPAN)
Erik Corry 2014/05/20 09:09:48 An alternative (I think simpler) way to do this wo
sof 2014/05/20 09:54:57 I like this,it just fits better all around to move
+ visitor->trace(m_atomicNameCaches);
+ visitor->trace(m_tagCollectionCacheNS);
+ visitor->trace(m_owner);
+ // NOTE: The m_childNodeList weak member is manually updated in
+ // clearWeakMembers() above hence not traced as a weak member
+ // here.
+ visitor->registerWeakMembers<NodeListsNodeData, &NodeListsNodeData::clearWeakMembers>(this);
+#endif
+}
+
void NodeRareData::traceAfterDispatch(Visitor* visitor)
{
visitor->trace(m_mutationObserverData);
+ visitor->trace(m_nodeLists);
}
void NodeRareData::trace(Visitor* visitor)

Powered by Google App Engine
This is Rietveld 408576698