Index: Source/core/dom/MutationObserverRegistration.cpp |
diff --git a/Source/core/dom/MutationObserverRegistration.cpp b/Source/core/dom/MutationObserverRegistration.cpp |
index 12816b0943bc7ef8a243660c0b9450f18fecb2a3..acca5690a54a3d1039c617a7758129937b9e8b6e 100644 |
--- a/Source/core/dom/MutationObserverRegistration.cpp |
+++ b/Source/core/dom/MutationObserverRegistration.cpp |
@@ -44,7 +44,7 @@ PassOwnPtrWillBeRawPtr<MutationObserverRegistration> MutationObserverRegistratio |
MutationObserverRegistration::MutationObserverRegistration(MutationObserver& observer, Node& registrationNode, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter) |
: m_observer(observer) |
- , m_registrationNode(registrationNode) |
+ , m_registrationNode(®istrationNode) |
Erik Corry
2014/05/05 14:28:46
This is called in exactly one place where we have
sof
2014/05/05 15:36:03
Yes, impedance matching now done.
|
, m_options(options) |
, m_attributeFilter(attributeFilter) |
{ |
@@ -53,15 +53,18 @@ 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() |
{ |
clearTransientRegistrations(); |
- m_observer->observationEnded(this); |
- m_observer.clear(); |
+ if (m_observer) { |
Erik Corry
2014/05/05 14:28:46
I wonder why we did not need this 'if' before?
sof
2014/05/05 14:57:36
We explicitly dispose() in Node::unregisterMutatio
Erik Corry
2014/05/05 14:58:43
I think it's cool as it is.
sof
2014/05/05 15:36:03
Thinking about it a bit more, it is preferable to
|
+ m_observer->observationEnded(this); |
+ m_observer.clear(); |
+ } |
} |
void MutationObserverRegistration::resetObservation(MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter) |
@@ -83,7 +86,7 @@ void MutationObserverRegistration::observedSubtreeNodeWillDetach(Node& node) |
m_transientRegistrationNodes = adoptPtr(new NodeHashSet); |
ASSERT(!m_registrationNodeKeepAlive); |
- m_registrationNodeKeepAlive = PassRefPtr<Node>(m_registrationNode); // Balanced in clearTransientRegistrations. |
+ m_registrationNodeKeepAlive = PassRefPtr<Node>(m_registrationNode.get()); // Balanced in clearTransientRegistrations. |
} |
m_transientRegistrationNodes->add(&node); |
} |
@@ -106,7 +109,7 @@ void MutationObserverRegistration::clearTransientRegistrations() |
void MutationObserverRegistration::unregister() |
{ |
- m_registrationNode.unregisterMutationObserver(this); |
+ 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,7 @@ bool MutationObserverRegistration::shouldReceiveMutationFrom(Node& node, Mutatio |
void MutationObserverRegistration::addRegistrationNodesToSet(HashSet<Node*>& nodes) const |
{ |
- nodes.add(&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 +143,7 @@ void MutationObserverRegistration::addRegistrationNodesToSet(HashSet<Node*>& nod |
void MutationObserverRegistration::trace(Visitor* visitor) |
{ |
visitor->trace(m_observer); |
+ visitor->trace(m_registrationNode); |
} |
} // namespace WebCore |