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

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

Issue 235113002: Oilpan: Remove guardRef and guardDeref from TreeScope. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments. Created 6 years, 8 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/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index edcac04a7e802c3106b53453088b9128102e179e..8bb20d5be7c0bc7d42b2b5d0c966394de9949c7c 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -279,8 +279,10 @@ Node::~Node()
if (m_next)
m_next->setPreviousSibling(0);
+#if !ENABLE(OILPAN)
if (m_treeScope)
m_treeScope->guardDeref();
+#endif
InspectorCounters::decrementCounter(InspectorCounters::NodeCounter);
@@ -290,6 +292,7 @@ Node::~Node()
void Node::willBeDeletedFromDocument()
{
+#if !ENABLE(OILPAN)
if (!isTreeScopeInitialized())
return;
@@ -305,6 +308,7 @@ void Node::willBeDeletedFromDocument()
cache->remove(this);
document.markers().removeMarkers(this);
+#endif
}
NodeRareData* Node::rareData() const
@@ -2029,12 +2033,17 @@ void Node::removeAllEventListenersRecursively()
}
}
-typedef HashMap<Node*, OwnPtr<EventTargetData> > EventTargetDataMap;
+typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<Node>, OwnPtr<EventTargetData> > EventTargetDataMap;
static EventTargetDataMap& eventTargetDataMap()
{
+#if ENABLE(OILPAN)
+ DEFINE_STATIC_LOCAL(Persistent<EventTargetDataMap>, map, (new EventTargetDataMap()));
+ return *map;
+#else
DEFINE_STATIC_LOCAL(EventTargetDataMap, map, ());
return map;
+#endif
}
EventTargetData* Node::eventTargetData()
@@ -2354,6 +2363,12 @@ bool Node::willRespondToTouchEvents()
}
// This is here for inlining
+#if ENABLE(OILPAN)
+inline void TreeScope::removedLastRefToScope()
+{
+ dispose();
+}
+#else
inline void TreeScope::removedLastRefToScope()
{
ASSERT_WITH_SECURITY_IMPLICATION(!deletionHasBegun());
@@ -2373,14 +2388,13 @@ inline void TreeScope::removedLastRefToScope()
#if !ASSERT_DISABLED
rootNode().m_inRemovedLastRefFunction = false;
#endif
-#if !ENABLE(OILPAN)
#if SECURITY_ASSERT_ENABLED
beginDeletion();
#endif
delete this;
-#endif
}
}
+#endif
// It's important not to inline removedLastRef, because we don't want to inline the code to
// delete a Node at each deref call site.
@@ -2542,6 +2556,11 @@ void Node::setCustomElementState(CustomElementState newState)
setNeedsStyleRecalc(SubtreeStyleChange); // :unresolved has changed
}
+void Node::trace(Visitor* visitor)
+{
+ visitor->trace(m_treeScope);
+}
+
} // namespace WebCore
#ifndef NDEBUG

Powered by Google App Engine
This is Rietveld 408576698