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

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

Issue 262093006: Oilpan: Make the Node hierarchy RefCountedGarbageCollected instead of TreeShared. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another build fix. 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/ContainerNode.cpp
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index da93bff22de1a2d8571dda61104063e66a1c7c36..04c55d0644d5f8bbd0c86355a63720908fd59ee3 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -72,6 +72,7 @@ static void collectChildrenAndRemoveFromOldParent(Node& node, NodeVector& nodes,
toContainerNode(node).removeChildren();
}
+#if !ENABLE(OILPAN)
void ContainerNode::removeDetachedChildren()
{
if (connectedSubframeCount()) {
@@ -81,6 +82,7 @@ void ContainerNode::removeDetachedChildren()
ASSERT(needsAttach());
removeDetachedChildrenInContainer<Node, ContainerNode>(*this);
}
+#endif
void ContainerNode::parserTakeAllChildrenFrom(ContainerNode& oldParent)
{
@@ -93,10 +95,12 @@ void ContainerNode::parserTakeAllChildrenFrom(ContainerNode& oldParent)
ContainerNode::~ContainerNode()
{
-#if !ENABLE(OILPAN)
+#if ENABLE(OILPAN)
+ ASSERT(needsAttach());
+#else
willBeDeletedFromDocument();
-#endif
removeDetachedChildren();
+#endif
}
bool ContainerNode::isChildTypeAllowed(const Node& child) const
@@ -254,11 +258,11 @@ void ContainerNode::insertBeforeCommon(Node& nextChild, Node& newChild)
ASSERT(m_lastChild != prev);
nextChild.setPreviousSibling(&newChild);
if (prev) {
- ASSERT(m_firstChild != nextChild);
+ ASSERT(firstChild() != nextChild);
ASSERT(prev->nextSibling() == nextChild);
prev->setNextSibling(&newChild);
} else {
- ASSERT(m_firstChild == nextChild);
+ ASSERT(firstChild() == nextChild);
m_firstChild = &newChild;
}
newChild.setParentOrShadowHostNode(this);
@@ -409,6 +413,13 @@ void ContainerNode::disconnectDescendantFrames()
ChildFrameDisconnector(*this).disconnect();
}
+void ContainerNode::trace(Visitor* visitor)
+{
+ visitor->trace(m_firstChild);
+ visitor->trace(m_lastChild);
+ Node::trace(visitor);
+}
+
void ContainerNode::removeChild(Node* oldChild, ExceptionState& exceptionState)
{
#if !ENABLE(OILPAN)
@@ -475,9 +486,9 @@ void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node& ol
nextChild->setPreviousSibling(previousChild);
if (previousChild)
previousChild->setNextSibling(nextChild);
- if (m_firstChild == oldChild)
+ if (m_firstChild == &oldChild)
tkent 2014/05/07 00:41:19 We should add operator==(const Member<Node>, const
Mads Ager (chromium) 2014/05/07 12:13:16 Yes, we should, thanks!
m_firstChild = nextChild;
- if (m_lastChild == oldChild)
+ if (m_lastChild == &oldChild)
m_lastChild = previousChild;
oldChild.setPreviousSibling(0);
@@ -564,9 +575,11 @@ void ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionState& excep
{
RefPtr<ContainerNode> protect(this);
+#if !ENABLE(OILPAN)
// Check that this node is not "floating".
// If it is, it can be deleted as a side effect of sending mutation events.
ASSERT(refCount() || parentOrShadowHostNode());
+#endif
// Make sure adding the new child is ok
if (!checkAcceptChild(newChild.get(), 0, exceptionState))
@@ -995,8 +1008,10 @@ static void dispatchChildRemovalEvents(Node& child)
void ContainerNode::updateTreeAfterInsertion(Node& child)
{
+#if !ENABLE(OILPAN)
ASSERT(refCount());
ASSERT(child.refCount());
+#endif
ChildListMutationScope(*this).childAdded(child);

Powered by Google App Engine
This is Rietveld 408576698