Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/ 1999/xlink" onload="load()"> | 1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/ 1999/xlink" onload="load()"> |
| 2 <defs> | 2 <defs> |
| 3 <rect id="rect" width="100" height="100" /> | 3 <rect id="rect" width="100" height="100" /> |
| 4 </defs> | 4 </defs> |
| 5 <g id="g"/> | 5 <g id="g"/> |
| 6 <text x="50" y="50" id="log"/> | 6 <text x="50" y="50" id="log"/> |
| 7 <script id="script"> | 7 <script id="script"> |
| 8 <![CDATA[ | 8 <![CDATA[ |
| 9 | 9 |
| 10 var g = document.getElementById("g"); | 10 var g = document.getElementById("g"); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 | 29 |
| 30 use.appendChild(anim); | 30 use.appendChild(anim); |
| 31 | 31 |
| 32 return use; | 32 return use; |
| 33 } | 33 } |
| 34 | 34 |
| 35 function cleanup() { | 35 function cleanup() { |
| 36 // Collect garbage before recording starting live node count, in case there are live elements from previous tests. | 36 // Collect garbage before recording starting live node count, in case there are live elements from previous tests. |
| 37 // FIXME: Unclear why two calls to collect() are required, see crbug.com/307 614 | 37 // FIXME: Unclear why two calls to collect() are required, see crbug.com/307 614 |
| 38 GCController.collect(); | 38 GCController.collect(); |
| 39 GCController.collect(); | 39 GCController.collect(); |
|
haraken
2014/03/26 03:39:03
What happens if we call GCController.collect() mor
| |
| 40 var originalLiveElements = internals.numberOfLiveNodes(); | 40 var originalLiveElements = internals.numberOfLiveNodes(); |
| 41 | 41 |
| 42 while (g.hasChildNodes()) | 42 while (g.hasChildNodes()) |
| 43 g.removeChild(g.lastChild); | 43 g.removeChild(g.lastChild); |
| 44 | 44 |
| 45 GCController.collect(); | 45 GCController.collect(); |
|
haraken
2014/03/26 03:39:03
Ditto.
| |
| 46 | 46 |
| 47 // FIXME: Why is this 400 instead of 200? | 47 // This is 400 instead of 200 as it creates shadow tree elements. |
| 48 var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400; | 48 var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400; |
| 49 if (liveDelta == 0) | 49 if (liveDelta <= 0) |
| 50 log("PASS"); | 50 log("PASS"); |
| 51 else | 51 else |
| 52 log("FAIL: " + liveDelta + " extra live node(s)"); | 52 log("FAIL: " + liveDelta + " extra live node(s)"); |
| 53 | 53 |
| 54 testRunner.notifyDone(); | 54 testRunner.notifyDone(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 function startTest() { | 57 function startTest() { |
| 58 // Hold a reference to rect.x.baseVal on the root instance. | 58 // Hold a reference to rect.x.baseVal on the root instance. |
| 59 xBaseVal = document.getElementById("rect").x.baseVal; | 59 xBaseVal = document.getElementById("rect").x.baseVal; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 71 } else { | 71 } else { |
| 72 log("This test only works when run with the testRunner, GCController, an d internals available."); | 72 log("This test only works when run with the testRunner, GCController, an d internals available."); |
| 73 return; | 73 return; |
| 74 } | 74 } |
| 75 | 75 |
| 76 setTimeout(startTest, 0); | 76 setTimeout(startTest, 0); |
| 77 } | 77 } |
| 78 ]]> | 78 ]]> |
| 79 </script> | 79 </script> |
| 80 </svg> | 80 </svg> |
| OLD | NEW |