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

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

Issue 2646633002: IntersectionObserver: remove gc-timing-revealing execeptions. (Closed)
Patch Set: Created 3 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 6effa417267e0b7dccc07f47e5e18038624b8b15..2d55282406f2ccc17586036c1e09d555105236ff 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
@@ -20,6 +20,7 @@ IntersectionObservation::IntersectionObservation(IntersectionObserver& observer,
void IntersectionObservation::computeIntersectionObservations(
DOMHighResTimeStamp timestamp) {
+ DCHECK(observer());
if (!m_target)
return;
Vector<Length> rootMargin(4);
@@ -57,7 +58,7 @@ void IntersectionObservation::computeIntersectionObservations(
geometry.targetRect().size().height().toFloat();
newVisibleRatio = intersectionArea / targetArea;
}
- newThresholdIndex = observer().firstThresholdGreaterThan(newVisibleRatio);
+ newThresholdIndex = observer()->firstThresholdGreaterThan(newVisibleRatio);
} else {
newVisibleRatio = 0;
newThresholdIndex = 0;
@@ -69,20 +70,15 @@ void IntersectionObservation::computeIntersectionObservations(
IntersectionObserverEntry* newEntry = new IntersectionObserverEntry(
timestamp, newVisibleRatio, geometry.targetIntRect(), rootBoundsPointer,
geometry.intersectionIntRect(), target());
- observer().enqueueIntersectionObserverEntry(*newEntry);
+ observer()->enqueueIntersectionObserverEntry(*newEntry);
setLastThresholdIndex(newThresholdIndex);
}
}
void IntersectionObservation::disconnect() {
- IntersectionObserver* observer = m_observer;
- clearRootAndRemoveFromTarget();
- observer->removeObservation(*this);
-}
-
-void IntersectionObservation::clearRootAndRemoveFromTarget() {
+ DCHECK(observer());
if (m_target)
- target()->ensureIntersectionObserverData().removeObservation(observer());
+ target()->ensureIntersectionObserverData().removeObservation(*observer());
m_observer.clear();
}

Powered by Google App Engine
This is Rietveld 408576698