Chromium Code Reviews

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

Issue 265793017: Oilpan: move node/element rare data objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased + EventHandler.cpp oilpan compile fix Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: Source/core/dom/NodeRareData.cpp
diff --git a/Source/core/dom/NodeRareData.cpp b/Source/core/dom/NodeRareData.cpp
index dcb570eced0e1fc8263c482f14c363fd01e916e7..bb95867f55a69fa922a651a4981a1b5c2a7e0523 100644
--- a/Source/core/dom/NodeRareData.cpp
+++ b/Source/core/dom/NodeRareData.cpp
@@ -31,13 +31,14 @@
#include "config.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/Element.h"
+#include "core/dom/ElementRareData.h"
#include "platform/heap/Handle.h"
namespace WebCore {
struct SameSizeAsNodeRareData {
void* m_pointer[2];
- OwnPtrWillBePersistent<NodeMutationObserverData> m_mutationObserverData;
+ OwnPtrWillBeMember<NodeMutationObserverData> m_mutationObserverData;
unsigned m_bitfields;
};
@@ -57,13 +58,25 @@ void NodeListsNodeData::invalidateCaches(const QualifiedName* attrName)
it->value->invalidateCache();
}
-void NodeRareData::dispose()
+void NodeRareData::traceAfterDispatch(Visitor* visitor)
{
- if (m_mutationObserverData) {
- for (unsigned i = 0; i < m_mutationObserverData->registry.size(); i++)
- m_mutationObserverData->registry.at(i)->dispose();
- m_mutationObserverData.clear();
- }
+ visitor->trace(m_mutationObserverData);
+}
+
+void NodeRareData::trace(Visitor* visitor)
+{
+ if (m_isElementRareData)
+ static_cast<ElementRareData*>(this)->traceAfterDispatch(visitor);
+ else
+ traceAfterDispatch(visitor);
+}
+
+void NodeRareData::finalizeGarbageCollectedObject()
+{
+ if (m_isElementRareData)
+ static_cast<ElementRareData*>(this)->~ElementRareData();
+ else
+ this->~NodeRareData();
}
// Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow

Powered by Google App Engine