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

Unified Diff: Source/core/dom/MutationObserverRegistration.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/MutationObserverRegistration.h ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/MutationObserverRegistration.cpp
diff --git a/Source/core/dom/MutationObserverRegistration.cpp b/Source/core/dom/MutationObserverRegistration.cpp
index 12816b0943bc7ef8a243660c0b9450f18fecb2a3..0ba07f1d38a2f679fb86a9192060c2367ff9f88a 100644
--- a/Source/core/dom/MutationObserverRegistration.cpp
+++ b/Source/core/dom/MutationObserverRegistration.cpp
@@ -37,12 +37,12 @@
namespace WebCore {
-PassOwnPtrWillBeRawPtr<MutationObserverRegistration> MutationObserverRegistration::create(MutationObserver& observer, Node& registrationNode, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
+PassOwnPtrWillBeRawPtr<MutationObserverRegistration> MutationObserverRegistration::create(MutationObserver& observer, Node* registrationNode, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
{
return adoptPtrWillBeNoop(new MutationObserverRegistration(observer, registrationNode, options, attributeFilter));
}
-MutationObserverRegistration::MutationObserverRegistration(MutationObserver& observer, Node& registrationNode, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
+MutationObserverRegistration::MutationObserverRegistration(MutationObserver& observer, Node* registrationNode, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
: m_observer(observer)
, m_registrationNode(registrationNode)
, m_options(options)
@@ -53,8 +53,9 @@ MutationObserverRegistration::MutationObserverRegistration(MutationObserver& obs
MutationObserverRegistration::~MutationObserverRegistration()
{
- // dispose() hasn't been called if this assert triggers.
- ASSERT(!m_observer);
+#if !ENABLE(OILPAN)
+ dispose();
+#endif
}
void MutationObserverRegistration::dispose()
@@ -82,8 +83,9 @@ void MutationObserverRegistration::observedSubtreeNodeWillDetach(Node& node)
if (!m_transientRegistrationNodes) {
m_transientRegistrationNodes = adoptPtr(new NodeHashSet);
+ ASSERT(m_registrationNode);
ASSERT(!m_registrationNodeKeepAlive);
- m_registrationNodeKeepAlive = PassRefPtr<Node>(m_registrationNode); // Balanced in clearTransientRegistrations.
+ m_registrationNodeKeepAlive = PassRefPtrWillBeRawPtr<Node>(m_registrationNode.get()); // Balanced in clearTransientRegistrations.
}
m_transientRegistrationNodes->add(&node);
}
@@ -106,7 +108,8 @@ void MutationObserverRegistration::clearTransientRegistrations()
void MutationObserverRegistration::unregister()
{
- m_registrationNode.unregisterMutationObserver(this);
+ ASSERT(m_registrationNode);
+ m_registrationNode->unregisterMutationObserver(this);
// The above line will cause this object to be deleted, so don't do any more in this function.
}
@@ -116,7 +119,7 @@ bool MutationObserverRegistration::shouldReceiveMutationFrom(Node& node, Mutatio
if (!(m_options & type))
return false;
- if (m_registrationNode != node && !isSubtree())
+ if (m_registrationNode != &node && !isSubtree())
return false;
if (type != MutationObserver::Attributes || !(m_options & MutationObserver::AttributeFilter))
@@ -130,7 +133,8 @@ bool MutationObserverRegistration::shouldReceiveMutationFrom(Node& node, Mutatio
void MutationObserverRegistration::addRegistrationNodesToSet(HashSet<Node*>& nodes) const
{
- nodes.add(&m_registrationNode);
+ ASSERT(m_registrationNode);
+ nodes.add(m_registrationNode.get());
if (!m_transientRegistrationNodes)
return;
for (NodeHashSet::const_iterator iter = m_transientRegistrationNodes->begin(); iter != m_transientRegistrationNodes->end(); ++iter)
@@ -140,6 +144,8 @@ void MutationObserverRegistration::addRegistrationNodesToSet(HashSet<Node*>& nod
void MutationObserverRegistration::trace(Visitor* visitor)
{
visitor->trace(m_observer);
+ visitor->trace(m_registrationNode);
+ visitor->trace(m_registrationNodeKeepAlive);
}
} // namespace WebCore
« no previous file with comments | « Source/core/dom/MutationObserverRegistration.h ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698