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

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: Only perform weak processing of the event handler registry if the document is active. 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..7a9ecd6b7200b6e7a738b44de704148170c28564 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,8 @@ Node::~Node()
void Node::willBeDeletedFromDocument()
{
+#if !ENABLE(OILPAN)
+ // With Oilpan all of this is handled with weak processing on the document.
haraken 2014/04/25 14:30:32 I'd put #if !ENABLE(OILPAN) around Node::willBeDel
Mads Ager (chromium) 2014/04/28 09:45:21 Thanks. That more clearly indicates what is going
if (!isTreeScopeInitialized())
return;
@@ -305,6 +309,7 @@ void Node::willBeDeletedFromDocument()
cache->remove(this);
document.markers().removeMarkers(this);
+#endif
}
NodeRareData* Node::rareData() const
@@ -2029,12 +2034,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 +2364,12 @@ bool Node::willRespondToTouchEvents()
}
// This is here for inlining
+#if ENABLE(OILPAN)
+inline void TreeScope::removedLastRefToScope()
haraken 2014/04/25 14:30:32 Just help me understand: How is removedLastRef wor
Mads Ager (chromium) 2014/04/28 09:45:21 When the last ref is removed to the tree scope we
+{
+ dispose();
+}
+#else
inline void TreeScope::removedLastRefToScope()
{
ASSERT_WITH_SECURITY_IMPLICATION(!deletionHasBegun());
@@ -2373,14 +2389,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 +2557,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