Index: third_party/WebKit/Source/core/dom/IntersectionObserver.cpp |
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp |
index 2a9cd6f082099d2d6f1c4e72da891af2950a7052..1d9ec9809e2c2231d0ffc421f75a0024a7ad3529 100644 |
--- a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp |
+++ b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp |
@@ -317,19 +317,22 @@ bool IntersectionObserver::hasPercentMargin() const |
|| m_leftMargin.type() == Percent); |
} |
-void IntersectionObserver::rootDisappearedCallback(Visitor* visitor, void* self) |
+#if ENABLE(OILPAN) |
+void IntersectionObserver::clearWeakMembers(Visitor* visitor) |
{ |
- IntersectionObserver* observer = static_cast<IntersectionObserver*>(self); |
- observer->disconnect(); |
+ if (Heap::isHeapObjectAlive(m_root)) |
+ return; |
+ disconnect(); |
+ m_root = nullptr; |
} |
+#endif |
DEFINE_TRACE(IntersectionObserver) |
{ |
#if ENABLE(OILPAN) |
- visitor->registerWeakMembers(this, m_root.get(), IntersectionObserver::rootDisappearedCallback); |
+ visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObserver::clearWeakMembers>(this); |
#endif |
visitor->trace(m_callback); |
- visitor->trace(m_root); |
visitor->trace(m_observations); |
visitor->trace(m_entries); |
} |