Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: LayoutTests/inspector/profiler/heap-snapshot-weak-dominator.html

Issue 674443003: DevTools: ignore weak referenced when calculating dominators for heap snapshot (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Renamed test function named as suggested by loislo Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/profiler/heap-snapshot-weak-dominator.html
diff --git a/LayoutTests/inspector/profiler/heap-snapshot-weak-dominator.html b/LayoutTests/inspector/profiler/heap-snapshot-weak-dominator.html
new file mode 100644
index 0000000000000000000000000000000000000000..0af1f55fd75aeb8f34d89d34bd462ffbc5aafe75
--- /dev/null
+++ b/LayoutTests/inspector/profiler/heap-snapshot-weak-dominator.html
@@ -0,0 +1,92 @@
+<html>
+<head>
+ <script src="../../http/tests/inspector/inspector-test.js"></script>
+ <script src="heap-snapshot-test.js"></script>
+<script>
+
+function test()
+{
+ InspectorTest.runHeapSnapshotTestSuite([
+ function testWeakReferencesDoNotAffectRetainedSize(next)
+ {
+ function createHeapSnapshot()
+ {
+ // Mocking results of running the following code:
+ // root = [new Uint8Array(1000), new Uint8Array(1000), new Uint8Array(1000)]
+ var builder = new InspectorTest.HeapSnapshotBuilder();
+ var rootNode = builder.rootNode;
+
+ var gcRootsNode = new InspectorTest.HeapNode("(GC roots)");
+ rootNode.linkNode(gcRootsNode, InspectorTest.HeapEdge.Type.element);
+
+ var windowNode = new InspectorTest.HeapNode("Window", 20);
+ rootNode.linkNode(windowNode, InspectorTest.HeapEdge.Type.shortcut);
+ gcRootsNode.linkNode(windowNode, InspectorTest.HeapEdge.Type.element);
+
+ var arrayNode = new InspectorTest.HeapNode("Array", 10);
+ windowNode.linkNode(arrayNode, InspectorTest.HeapEdge.Type.property, "root");
+ var prevBufferNode = null;
+ for (var i = 0; i < 3; i++) {
+ var typedArrayNode = new InspectorTest.HeapNode("Uint8Array", 100);
+ arrayNode.linkNode(typedArrayNode, InspectorTest.HeapEdge.Type.element);
+
+ var bufferNode = new InspectorTest.HeapNode("ArrayBuffer", 1000);
+ typedArrayNode.linkNode(bufferNode, InspectorTest.HeapEdge.Type.internal);
+ if (prevBufferNode)
+ prevBufferNode.linkNode(bufferNode, InspectorTest.HeapEdge.Type.weak, "weak_next");
+ prevBufferNode = bufferNode;
+ }
+
+ return builder.generateSnapshot();
+ }
+
+ InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
+
+ function step1()
+ {
+ InspectorTest.switchToView("Summary", step2);
+ }
+
+ function step2()
+ {
+ var row = InspectorTest.findRow("Array");
+ InspectorTest.assertEquals(true, !!row, "\"Array\" row");
+ InspectorTest.expandRow(row, step3);
+ }
+
+ function step3(row)
+ {
+ InspectorTest.assertEquals(1, row._count);
+ InspectorTest.assertEquals(3310, row._retainedSize);
+ InspectorTest.assertEquals(10, row._shallowSize);
+ InspectorTest.expandRow(row.children[0], step4);
+ }
+
+ function step4(arrayInstanceRow)
+ {
+ InspectorTest.assertEquals(2, arrayInstanceRow._distance);
+ InspectorTest.assertEquals(3310, arrayInstanceRow._retainedSize);
+ InspectorTest.assertEquals(10, arrayInstanceRow._shallowSize);
+
+ var children = arrayInstanceRow.children;
+ InspectorTest.assertEquals(3, children.length);
+
+ for (var i = 0; i < children.length; i++) {
+ InspectorTest.assertEquals("Uint8Array", children[i]._name);
+ InspectorTest.assertEquals(100, children[i]._shallowSize);
+ InspectorTest.assertEquals(1100, children[i]._retainedSize);
+ }
+ setTimeout(next, 0);
+ }
+ }
+ ]);
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<pre>
+Tests that weak references are ignored when dominators are calculated and that weak references won't affect object's retained size.
+</pre>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698