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

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

Issue 2565863002: IntersectionObserver: use post task inside of resume(). (Closed)
Patch Set: Added test Created 4 years 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/IntersectionObserverController.cpp
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp b/third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp
index d0888bc33b42b649732eea215d9a7386cf034955..7dc6e19dd9782c64976ff797a00cdf738036e26f 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp
+++ b/third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp
@@ -26,9 +26,7 @@ IntersectionObserverController::IntersectionObserverController(
IntersectionObserverController::~IntersectionObserverController() {}
-void IntersectionObserverController::scheduleIntersectionObserverForDelivery(
- IntersectionObserver& observer) {
- m_pendingIntersectionObservers.add(&observer);
+void IntersectionObserverController::postTaskToDeliverObservations() {
if (!m_weakPtrFactory.hasWeakPtrs()) {
// TODO(ojan): These tasks decide whether to throttle a subframe, so they
// need to be unthrottled, but we should throttle all the other tasks
@@ -41,12 +39,18 @@ void IntersectionObserverController::scheduleIntersectionObserverForDelivery(
}
}
+void IntersectionObserverController::scheduleIntersectionObserverForDelivery(
+ IntersectionObserver& observer) {
+ m_pendingIntersectionObservers.add(&observer);
+ postTaskToDeliverObservations();
+}
+
void IntersectionObserverController::resume() {
// If the callback fired while DOM objects were suspended, notifications might
// be late, so deliver them right away (rather than waiting to fire again).
if (m_callbackFiredWhileSuspended) {
m_callbackFiredWhileSuspended = false;
- deliverIntersectionObservations();
+ postTaskToDeliverObservations();
}
}

Powered by Google App Engine
This is Rietveld 408576698