Title: [290900] trunk/LayoutTests
Revision
290900
Author
commit-qu...@webkit.org
Date
2022-03-07 11:27:00 -0800 (Mon, 07 Mar 2022)

Log Message

LayoutTests/webgl/max-active-contexts-gc.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=237466

Patch by Kimmo Kinnunen <kkinnu...@apple.com> on 2022-03-07
Reviewed by Alexey Proskuryakov.
The test:
 - created 16 WebGL contexts
 - unreferenced 8 WebGL contexts.
 - forced gc
 - added 9 WebGL contexts.
The test tries to test that GC removes unreferenced contexts.
To assert this, it ends up with 17 contexts, which is 1 above
the maximum active limit. This means one context is lost and the
implementation prints one line of error.

Since the GC is not exact, sometimes it would only collect 7 of the 8
unreferenced contexts. This would mean two error messages.

Fix by trying to collect each time a context is unreferenced. This seems to be
more predictable.

* webgl/max-active-contexts-gc.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290899 => 290900)


--- trunk/LayoutTests/ChangeLog	2022-03-07 19:21:15 UTC (rev 290899)
+++ trunk/LayoutTests/ChangeLog	2022-03-07 19:27:00 UTC (rev 290900)
@@ -1,3 +1,27 @@
+2022-03-07  Kimmo Kinnunen  <kkinnu...@apple.com>
+
+        LayoutTests/webgl/max-active-contexts-gc.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=237466
+
+        Reviewed by Alexey Proskuryakov.
+        The test:
+         - created 16 WebGL contexts
+         - unreferenced 8 WebGL contexts.
+         - forced gc
+         - added 9 WebGL contexts.
+        The test tries to test that GC removes unreferenced contexts.
+        To assert this, it ends up with 17 contexts, which is 1 above
+        the maximum active limit. This means one context is lost and the
+        implementation prints one line of error.
+
+        Since the GC is not exact, sometimes it would only collect 7 of the 8
+        unreferenced contexts. This would mean two error messages.
+
+        Fix by trying to collect each time a context is unreferenced. This seems to be
+        more predictable.
+
+        * webgl/max-active-contexts-gc.html:
+
 2022-03-07  Chris Dumez  <cdu...@apple.com>
 
         Make "true" count as truthy in window.open()'s boolean features

Modified: trunk/LayoutTests/webgl/max-active-contexts-gc.html (290899 => 290900)


--- trunk/LayoutTests/webgl/max-active-contexts-gc.html	2022-03-07 19:21:15 UTC (rev 290899)
+++ trunk/LayoutTests/webgl/max-active-contexts-gc.html	2022-03-07 19:27:00 UTC (rev 290900)
@@ -1,5 +1,9 @@
 <script>
-function forceGC() {
+function collect() {
+    if (window.GCController) {
+        GCController.collect();
+        return;
+    }
     try {
         for (var ndx = 0; ndx < 99000; ndx++)
             var numbers = new Float64Array(50 * 1024);
@@ -24,24 +28,18 @@
     addContext();
 
 // Now remove some of those contexts from this array so they may be garbage collected.
-while (contexts.length > contextsToKeep)
+while (contexts.length > contextsToKeep) {
     contexts.shift();
+    collect();
+}
 
+// Add contexts until we get to the limit then add one more. This should only
+// produce a single warning that an older context will be lost.
 setTimeout(function() {
-    if (window.GCController)
-        GCController.collect();
-    else
-        forceGC();
-
-    // Add contexts until we get to the limit then add one more. This should only
-    // produce a single warning that an older context will be lost.
-    setTimeout(function() {
-        while (contexts.length < maxNumberOfActiveContexts + 1)
-            addContext();
-
-        if (window.testRunner)
-            testRunner.notifyDone();
-    });
+    while (contexts.length < maxNumberOfActiveContexts + 1)
+        addContext();
+    if (window.testRunner)
+        testRunner.notifyDone();
 });
 
 </script>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to