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

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 + add some asserts for registration Node being present. 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
« no previous file with comments | « Source/core/dom/NodeRareData.h ('k') | Source/core/dom/shadow/ElementShadow.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/NodeRareData.cpp
diff --git a/Source/core/dom/NodeRareData.cpp b/Source/core/dom/NodeRareData.cpp
index dcb570eced0e1fc8263c482f14c363fd01e916e7..c29894c2a00a5f2807675c7d17679ae65a955043 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,26 @@ 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()
+{
+ RELEASE_ASSERT(!renderer());
+ if (m_isElementRareData)
+ static_cast<ElementRareData*>(this)->~ElementRareData();
+ else
+ this->~NodeRareData();
}
// Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow
« no previous file with comments | « Source/core/dom/NodeRareData.h ('k') | Source/core/dom/shadow/ElementShadow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698