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

Unified Diff: third_party/WebKit/Source/core/dom/IntersectionObservation.cpp

Issue 1603773002: Use registerWeakMembers to manage observer root. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: nit scratched Created 4 years, 11 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: third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
index 1f06da2f7f20b48a858b902738a2a7bf00991ed3..a32edd7be70bcdf562207bb7a3100af44988a3d6 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
@@ -161,9 +161,15 @@ void IntersectionObservation::computeIntersectionObservations(double timestamp)
void IntersectionObservation::disconnect()
{
+ IntersectionObserver* observer = m_observer;
+ clearRootAndRemoveFromTarget();
+ observer->removeObservation(*this);
+}
+
+void IntersectionObservation::clearRootAndRemoveFromTarget()
+{
if (m_target)
- target()->ensureIntersectionObserverData().removeObservation(this->observer());
- m_observer->removeObservation(*this);
+ target()->ensureIntersectionObserverData().removeObservation(observer());
m_observer.clear();
}

Powered by Google App Engine
This is Rietveld 408576698