Chromium Code Reviews| Index: LayoutTests/svg/animations/smil-leak-element-instances.svg |
| diff --git a/LayoutTests/svg/animations/smil-leak-element-instances.svg b/LayoutTests/svg/animations/smil-leak-element-instances.svg |
| index 560e41aa39d302c1afaba4b52abe2c459c10755f..88dcd8e839a8c06cd61e6c9f7e4ede086a24a4c7 100644 |
| --- a/LayoutTests/svg/animations/smil-leak-element-instances.svg |
| +++ b/LayoutTests/svg/animations/smil-leak-element-instances.svg |
| @@ -32,24 +32,45 @@ function createAnimatedRectInstance() { |
| return use; |
| } |
| +// 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); |
| + collectGarbage(function() { |
| + var originalLiveElements = internals.numberOfLiveNodes(); |
| - GCController.collectAll(); |
| + while (g.hasChildNodes()) |
| + g.removeChild(g.lastChild); |
| - // This is 400 instead of 200 as it creates shadow tree elements. |
| - var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400; |
| - if (liveDelta == 0) |
| - log("PASS"); |
| - else |
| - log("FAIL: " + liveDelta + " extra live node(s)"); |
| + collectGarbage(function() { |
| + // This is 400 instead of 200 as it creates shadow tree elements. |
| + 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
Also can't we waitUntilDone here to not exit until
Mads Ager (chromium)
2014/04/01 13:45:38
Already done in the load function.
|
| function startTest() { |