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

Unified Diff: third_party/WebKit/LayoutTests/resources/intersection-observer-helper-functions.js

Issue 2322143002: Switch IntersectionObserver to postTask. (Closed)
Patch Set: use weakptr Created 4 years, 3 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/LayoutTests/resources/intersection-observer-helper-functions.js
diff --git a/third_party/WebKit/LayoutTests/resources/intersection-observer-helper-functions.js b/third_party/WebKit/LayoutTests/resources/intersection-observer-helper-functions.js
index 050274da18dcd5bff5bbd65d8f981fd1fb35c557..d0d31fcacb1d58ef7415b1bb7686547358301501 100644
--- a/third_party/WebKit/LayoutTests/resources/intersection-observer-helper-functions.js
+++ b/third_party/WebKit/LayoutTests/resources/intersection-observer-helper-functions.js
@@ -6,7 +6,7 @@ if (self.isJsTest) {
self.jsTestIsAsync = true;
}
-// waitForNotification is a requestIdleCallback wrapped in a setTimeout wrapped in a
+// waitForNotification is a setTimeout wrapped in a setTimeout wrapped in a
// requestAnimationFrame. What in the wide, wide world of sports is going on here?
//
// Here's the order of events:
@@ -17,32 +17,22 @@ if (self.isJsTest) {
// - requestAnimationFrame
// - BeginFrame
// - requestAnimationFrame handler runs.
-// - setTimeout
+// - queue first setTimeout
// - FrameView::updateAllLifecyclePhases
// - IntersectionObserver generates notification based on the new layout.
-// - Post idle task to deliver notification.
-// - setTimeout handler runs.
-// - testRunner.runIdleTasks or requestIdleCallback.
-// - Idle tasks run -- more or less immediately if (self.testRunner),
-// possibly delayed if (!self.testRunner).
+// - Post task to deliver notification.
+// - first setTimeout runs.
+// - queue second setTimeout
+// - Posted task runs.
// - IntersectionObserver notifications are delivered.
-// - secondTestFunction
-// - Verify notifications generated by firstTestFunction.
-// - Change layout to generate new IntersectionObserver notifications.
-// - waitForNotification(thirdTestFunction)
-//
-// Note that this should work equally well in these operation conditions:
-//
-// - layout test using single-threaded compositing (the default)
-// - layout test using multi-threaded compositing (virtual/threaded/)
-// - Not in a layout test and using multi-threaded compositing (the only configuration we ship)
+// - second setTimeout runs secondTestFunction
+// - Verify notifications generated by firstTestFunction.
+// - Change layout to generate new IntersectionObserver notifications.
+// - waitForNotification(thirdTestFunction)
function waitForNotification(f) {
requestAnimationFrame(() => {
setTimeout(() => {
- if (self.testRunner)
- testRunner.runIdleTasks(f);
- else
- requestIdleCallback(f);
+ setTimeout(f);
});
});
}

Powered by Google App Engine
This is Rietveld 408576698