Index: LayoutTests/svg/animations/smil-leak-elements.svg |
diff --git a/LayoutTests/svg/animations/smil-leak-elements.svg b/LayoutTests/svg/animations/smil-leak-elements.svg |
index 040aec71988d15e416f77ab70b76908755890be6..7d38dfba0dcdf4ed8147342a7c3b7d3a4d3069ef 100644 |
--- a/LayoutTests/svg/animations/smil-leak-elements.svg |
+++ b/LayoutTests/svg/animations/smil-leak-elements.svg |
@@ -30,23 +30,42 @@ function createAnimatedRect() { |
return rect; |
} |
+// With Oilpan tests that rely on garbage collection need to go through |
+// the event loop in order to get precise garbage collections. Oilpan |
+// uses conservative stack scanning when not at the event loop and that |
+// can artificially keep objects alive. Therfore, test that need to check |
wibling-chromium
2014/04/01 13:26:09
Ditto.
Mads Ager (chromium)
2014/04/01 13:45:38
Done.
|
+// that something is dead need to use this asynchronous collectGarbage |
+// function. |
+function collectGarbage(callback) { |
+ GCController.collect(); |
+ setTimeout(function() { |
+ GCController.collect(); |
+ setTimeout(function() { |
+ GCController.collect(); |
+ setTimeout(function() { |
+ GCController.collect(); |
+ setTimeout(callback, 0); |
+ }, 0); |
+ }, 0); |
+ }, 0); |
+} |
+ |
function cleanup() { |
// Collect garbage before recording starting live node count, in case there are live elements from previous tests. |
- GCController.collectAll(); |
- var originalLiveElements = internals.numberOfLiveNodes(); |
- |
- while (g.hasChildNodes()) |
- g.removeChild(g.lastChild); |
- |
- GCController.collectAll(); |
- |
- var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 200; |
- if (liveDelta == 0) |
- log("PASS"); |
- else |
- log("FAIL: " + liveDelta + " extra live node(s)"); |
+ collectGarbage(function() { |
+ var originalLiveElements = internals.numberOfLiveNodes(); |
- testRunner.notifyDone(); |
+ while (g.hasChildNodes()) |
+ g.removeChild(g.lastChild); |
+ collectGarbage(function() { |
+ var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 200; |
+ if (liveDelta == 0) |
+ log("PASS"); |
+ else |
+ log("FAIL: " + liveDelta + " extra live node(s)"); |
+ testRunner.notifyDone(); |
+ }); |
+ }); |
} |
function startTest() { |