Index: LayoutTests/svg/animations/smil-leak-dynamically-added-element-instances.svg |
diff --git a/LayoutTests/svg/animations/smil-leak-dynamically-added-element-instances.svg b/LayoutTests/svg/animations/smil-leak-dynamically-added-element-instances.svg |
index b7ecf34e878d9526be78392c3239741fe6e33cfa..8a254b6d89ced0dc6ff5d26b8b8e0c7eff3a24e9 100644 |
--- a/LayoutTests/svg/animations/smil-leak-dynamically-added-element-instances.svg |
+++ b/LayoutTests/svg/animations/smil-leak-dynamically-added-element-instances.svg |
@@ -32,26 +32,44 @@ function createAnimatedRectInstance() { |
return use; |
} |
-function cleanup() { |
- // Collect garbage before recording starting live node count, in case there are live elements from previous tests. |
- // FIXME: Unclear why two calls to collect() are required, see crbug.com/307614 |
- GCController.collect(); |
+// 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(); |
- var originalLiveElements = internals.numberOfLiveNodes(); |
+ setTimeout(function() { |
+ GCController.collect(); |
+ setTimeout(function() { |
+ GCController.collect(); |
+ setTimeout(function() { |
+ GCController.collect(); |
+ setTimeout(callback, 0); |
+ }, 0); |
+ }, 0); |
+ }, 0); |
+} |
- while (g.hasChildNodes()) |
- g.removeChild(g.lastChild); |
+function cleanup() { |
+ collectGarbage(function() { |
+ var originalLiveElements = internals.numberOfLiveNodes(); |
- GCController.collect(); |
+ while (g.hasChildNodes()) |
+ g.removeChild(g.lastChild); |
- // FIXME: Why 400 and not 200? |
- var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400; |
- if (liveDelta == 0) |
- log("PASS"); |
- else |
- log("FAIL: " + liveDelta + " extra live node(s)"); |
+ collectGarbage(function() { |
+ // FIXME: Why 400 and not 200? |
+ var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400; |
+ if (liveDelta == 0) |
+ log("PASS"); |
+ else |
+ log("FAIL: " + liveDelta + " extra live node(s)"); |
- testRunner.notifyDone(); |
+ testRunner.notifyDone(); |
+ }); |
+ }); |
} |
wibling-chromium
2014/04/01 13:26:09
Could you do a testRunner.waitUntilDone() here to
Mads Ager (chromium)
2014/04/01 13:45:38
That has already been done. In the onload event we
|
function addMoreInstances() { |