Index: Source/core/dom/MutationObserverRegistration.cpp |
diff --git a/Source/core/dom/MutationObserverRegistration.cpp b/Source/core/dom/MutationObserverRegistration.cpp |
index 2680bb73b6601eb2e57e356936c800d56c623464..ab723fa4535e78fc27bb99603de702cb177d1df9 100644 |
--- a/Source/core/dom/MutationObserverRegistration.cpp |
+++ b/Source/core/dom/MutationObserverRegistration.cpp |
@@ -37,9 +37,9 @@ |
namespace WebCore { |
-PassOwnPtr<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 adoptPtr(new MutationObserverRegistration(observer, registrationNode, options, attributeFilter)); |
+ return adoptPtrWillBeNoop(new MutationObserverRegistration(observer, registrationNode, options, attributeFilter)); |
} |
MutationObserverRegistration::MutationObserverRegistration(MutationObserver& observer, Node& registrationNode, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter) |
@@ -53,8 +53,27 @@ MutationObserverRegistration::MutationObserverRegistration(MutationObserver& obs |
MutationObserverRegistration::~MutationObserverRegistration() |
{ |
+#if ENABLE(OILPAN) |
+ // The observer is heap allocated, and cannot be accessed. |
+ // |
+ // So should an observer still have this object in its |
+ // list of registrations, and that observer lives beyond |
+ // the current sweep, this dead registration object might |
Erik Corry
2014/04/16 08:02:52
This doesn't make any sense to me. The pointer fr
|
+ // be attempted accessed. Hence, insist that all |
+ // MutationObserverRegistration objects are explicitly |
+ // dispose()d before being let go of. |
+ ASSERT(!m_observer); |
+#endif |
+ dispose(); |
haraken
2014/04/17 05:37:12
Can you restructure the code so that dispose() is
sof
2014/04/17 12:41:55
Certainly; have a look now.
|
+} |
+ |
+void MutationObserverRegistration::dispose() |
+{ |
clearTransientRegistrations(); |
Erik Corry
2014/04/16 08:20:48
I think if the transientRegistrations were a weak
sof
2014/04/16 15:29:47
This seems very relevant to what I'm faced with (n
haraken
2014/04/17 05:37:12
Just help me understand: At the point where V8's G
sof
2014/04/17 12:41:55
Consider what happens when a Node is destructed an
haraken
2014/04/17 13:20:54
Hmm, I think you're talking about the following si
sof
2014/04/17 13:47:31
There's a level of indirection, the persistent is
haraken
2014/04/17 14:01:37
Hmm, this is a hard problem.
It seems that the re
sof
2014/04/17 15:54:37
Yes, it just so happens that the MutationObserver
Erik Corry
2014/04/22 12:46:54
Sorry, when I wrote transientRegistrations I reall
|
- m_observer->observationEnded(this); |
+ if (m_observer) { |
+ m_observer->observationEnded(this); |
+ m_observer.clear(); |
+ } |
} |
void MutationObserverRegistration::resetObservation(MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter) |
@@ -130,4 +149,9 @@ void MutationObserverRegistration::addRegistrationNodesToSet(HashSet<Node*>& nod |
nodes.add(iter->get()); |
} |
+void MutationObserverRegistration::trace(Visitor* visitor) |
+{ |
+ visitor->trace(m_observer); |
+} |
+ |
} // namespace WebCore |