Title: [199379] trunk
Revision
199379
Author
[email protected]
Date
2016-04-12 12:35:12 -0700 (Tue, 12 Apr 2016)

Log Message

Web Inspector: Should be able to expand Objects in Heap Allocations View to see exactly what it retains
https://bugs.webkit.org/show_bug.cgi?id=156419
<rdar://problem/25633863>

Reviewed by Timothy Hatcher.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Main.html:
Remove strings, and fix sort.

* UserInterface/Models/HeapSnapshotRootPath.js:
(WebInspector.HeapSnapshotRootPath.pathComponentForIndividualEdge):
(WebInspector.HeapSnapshotRootPath.canPropertyNameBeDotAccess):
(WebInspector.HeapSnapshotRootPath.prototype.appendPropertyName):
(WebInspector.HeapSnapshotRootPath.prototype._canPropertyNameBeDotAccess):
Provide a helper to get an path component string for an individual edge.

* UserInterface/Models/PropertyPreview.js:
(WebInspector.PropertyPreview):
Fix an assert that may have errantly fired for an empty string name.

* UserInterface/Proxies/HeapSnapshotNodeProxy.js:
(WebInspector.HeapSnapshotNodeProxy):
(WebInspector.HeapSnapshotNodeProxy.deserialize):
Include "hasChildren" property in the original proxy message.

(WebInspector.HeapSnapshotNodeProxy.prototype.retainedNodes):
The method now also returns a list of edges for each of the retained nodes.

* UserInterface/Views/HeapSnapshotInstanceDataGridNode.js:
(WebInspector.HeapSnapshotInstanceDataGridNode):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.createCellContent):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.sort):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._populate):
An instance DataGrid node can now show children. It can expand to show
its retained node graph.

* UserInterface/Workers/HeapSnapshot/HeapSnapshot.js:
(HeapSnapshot.instancesWithClassName):
(HeapSnapshot.prototype.dominatedNodes):
(HeapSnapshot.prototype.retainers):
(HeapSnapshot.prototype.serializeNode):
Remove unnecessary calls to bind in favor of using the `thisObject` argument.

(HeapSnapshot.prototype.retainedNodes):
Return a parallel list of edges for each of the nodes.

* UserInterface/Views/HeapSnapshotClassDataGridNode.js:
(WebInspector.HeapSnapshotClassDataGridNode.prototype.createCellContent):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._populate):
* UserInterface/Views/HeapSnapshotClusterContentView.js:
(WebInspector.HeapSnapshotClusterContentView.prototype.get summaryContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype.get instancesContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype.shown):
(WebInspector.HeapSnapshotClusterContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype.get navigationItems): Deleted.
(WebInspector.HeapSnapshotClusterContentView.prototype._contentViewExtraArguments): Deleted.
(WebInspector.HeapSnapshotClusterContentView.prototype._toggleShowInternalObjectsSetting): Deleted.
(WebInspector.HeapSnapshotClusterContentView.prototype._updateViewsForShowInternalObjectsSettingValue): Deleted.
(WebInspector.HeapSnapshotClusterContentView.prototype._updateShowInternalObjectsButtonNavigationItem): Deleted.
* UserInterface/Views/HeapSnapshotInstancesContentView.js:
(WebInspector.HeapSnapshotInstancesContentView):
(WebInspector.HeapSnapshotInstancesContentView.prototype.get showInternalObjects): Deleted.
(WebInspector.HeapSnapshotInstancesContentView.prototype.set showInternalObjects): Deleted.
* UserInterface/Views/HeapSnapshotInstancesDataGridTree.js:
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype._populateTopLevel):
(WebInspector.HeapSnapshotInstancesDataGridTree):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.get includeInternalObjects): Deleted.
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.set includeInternalObjects): Deleted.
* UserInterface/Views/HeapSnapshotSummaryContentView.js:
Remove the show/hide internal objects button. In the Instances view we will
only show non-Internal objects at the top level, and show internal objects
when those instances are expanded.

LayoutTests:

* inspector/unit-tests/heap-snapshot-expected.txt:
* inspector/unit-tests/heap-snapshot.html:
Add a quick test that retainedNodes returns a list of edges.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199378 => 199379)


--- trunk/LayoutTests/ChangeLog	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/LayoutTests/ChangeLog	2016-04-12 19:35:12 UTC (rev 199379)
@@ -1,3 +1,15 @@
+2016-04-12  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Should be able to expand Objects in Heap Allocations View to see exactly what it retains
+        https://bugs.webkit.org/show_bug.cgi?id=156419
+        <rdar://problem/25633863>
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/unit-tests/heap-snapshot-expected.txt:
+        * inspector/unit-tests/heap-snapshot.html:
+        Add a quick test that retainedNodes returns a list of edges.
+
 2016-04-12  Myles C. Maxfield  <[email protected]>
 
         [RTL Scrollbars] Overlay scrollbars push contents inwards

Modified: trunk/LayoutTests/inspector/unit-tests/heap-snapshot-expected.txt (199378 => 199379)


--- trunk/LayoutTests/inspector/unit-tests/heap-snapshot-expected.txt	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/LayoutTests/inspector/unit-tests/heap-snapshot-expected.txt	2016-04-12 19:35:12 UTC (rev 199379)
@@ -34,6 +34,7 @@
 
 -- Running test case: HeapSnapshotNodeProxy.prototype.retainedNodes
 PASS: Number of retained nodes should match.
+PASS: Number of edges should match the number of nodes.
 PASS: Node values should match.
 
 -- Running test case: HeapSnapshotNodeProxy.prototype.retainers

Modified: trunk/LayoutTests/inspector/unit-tests/heap-snapshot.html (199378 => 199379)


--- trunk/LayoutTests/inspector/unit-tests/heap-snapshot.html	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/LayoutTests/inspector/unit-tests/heap-snapshot.html	2016-04-12 19:35:12 UTC (rev 199379)
@@ -229,10 +229,11 @@
             let expectedNodes = testSnapshotNodeForWindowObject.outgoingEdges.map((edge) => edge.to);
             expectedNodes.sort((a, b) => a.id - b.id);
 
-            snapshotNodeForWindowObject.retainedNodes((nodes) => {
+            snapshotNodeForWindowObject.retainedNodes((nodes, edges) => {
                 nodes.sort((a, b) => a.id - b.id);
                 InspectorTest.assert(nodes.length > 0, "Test only makes since if there are retained nodes");
                 InspectorTest.expectThat(nodes.length === expectedNodes.length, "Number of retained nodes should match.");
+                InspectorTest.expectThat(nodes.length === edges.length, "Number of edges should match the number of nodes.");
                 InspectorTest.expectThat(nodes.every((node, i) => compareNodes(node, expectedNodes[i])), "Node values should match.");
                 resolve();
             });

Modified: trunk/Source/WebInspectorUI/ChangeLog (199378 => 199379)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-04-12 19:35:12 UTC (rev 199379)
@@ -1,3 +1,79 @@
+2016-04-12  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Should be able to expand Objects in Heap Allocations View to see exactly what it retains
+        https://bugs.webkit.org/show_bug.cgi?id=156419
+        <rdar://problem/25633863>
+
+        Reviewed by Timothy Hatcher.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Main.html:
+        Remove strings, and fix sort.
+
+        * UserInterface/Models/HeapSnapshotRootPath.js:
+        (WebInspector.HeapSnapshotRootPath.pathComponentForIndividualEdge):
+        (WebInspector.HeapSnapshotRootPath.canPropertyNameBeDotAccess):
+        (WebInspector.HeapSnapshotRootPath.prototype.appendPropertyName):
+        (WebInspector.HeapSnapshotRootPath.prototype._canPropertyNameBeDotAccess):
+        Provide a helper to get an path component string for an individual edge.
+
+        * UserInterface/Models/PropertyPreview.js:
+        (WebInspector.PropertyPreview):
+        Fix an assert that may have errantly fired for an empty string name.
+
+        * UserInterface/Proxies/HeapSnapshotNodeProxy.js:
+        (WebInspector.HeapSnapshotNodeProxy):
+        (WebInspector.HeapSnapshotNodeProxy.deserialize):
+        Include "hasChildren" property in the original proxy message.
+
+        (WebInspector.HeapSnapshotNodeProxy.prototype.retainedNodes):
+        The method now also returns a list of edges for each of the retained nodes.
+
+        * UserInterface/Views/HeapSnapshotInstanceDataGridNode.js:
+        (WebInspector.HeapSnapshotInstanceDataGridNode):
+        (WebInspector.HeapSnapshotInstanceDataGridNode.prototype.createCellContent):
+        (WebInspector.HeapSnapshotInstanceDataGridNode.prototype.sort):
+        (WebInspector.HeapSnapshotInstanceDataGridNode.prototype._populate):
+        An instance DataGrid node can now show children. It can expand to show
+        its retained node graph.
+
+        * UserInterface/Workers/HeapSnapshot/HeapSnapshot.js:
+        (HeapSnapshot.instancesWithClassName):
+        (HeapSnapshot.prototype.dominatedNodes):
+        (HeapSnapshot.prototype.retainers):
+        (HeapSnapshot.prototype.serializeNode):
+        Remove unnecessary calls to bind in favor of using the `thisObject` argument.
+
+        (HeapSnapshot.prototype.retainedNodes):
+        Return a parallel list of edges for each of the nodes.
+
+        * UserInterface/Views/HeapSnapshotClassDataGridNode.js:
+        (WebInspector.HeapSnapshotClassDataGridNode.prototype.createCellContent):
+        (WebInspector.HeapSnapshotClassDataGridNode.prototype._populate):
+        * UserInterface/Views/HeapSnapshotClusterContentView.js:
+        (WebInspector.HeapSnapshotClusterContentView.prototype.get summaryContentView):
+        (WebInspector.HeapSnapshotClusterContentView.prototype.get instancesContentView):
+        (WebInspector.HeapSnapshotClusterContentView.prototype.shown):
+        (WebInspector.HeapSnapshotClusterContentView):
+        (WebInspector.HeapSnapshotClusterContentView.prototype.get navigationItems): Deleted.
+        (WebInspector.HeapSnapshotClusterContentView.prototype._contentViewExtraArguments): Deleted.
+        (WebInspector.HeapSnapshotClusterContentView.prototype._toggleShowInternalObjectsSetting): Deleted.
+        (WebInspector.HeapSnapshotClusterContentView.prototype._updateViewsForShowInternalObjectsSettingValue): Deleted.
+        (WebInspector.HeapSnapshotClusterContentView.prototype._updateShowInternalObjectsButtonNavigationItem): Deleted.
+        * UserInterface/Views/HeapSnapshotInstancesContentView.js:
+        (WebInspector.HeapSnapshotInstancesContentView):
+        (WebInspector.HeapSnapshotInstancesContentView.prototype.get showInternalObjects): Deleted.
+        (WebInspector.HeapSnapshotInstancesContentView.prototype.set showInternalObjects): Deleted.
+        * UserInterface/Views/HeapSnapshotInstancesDataGridTree.js:
+        (WebInspector.HeapSnapshotInstancesDataGridTree.prototype._populateTopLevel):
+        (WebInspector.HeapSnapshotInstancesDataGridTree):
+        (WebInspector.HeapSnapshotInstancesDataGridTree.prototype.get includeInternalObjects): Deleted.
+        (WebInspector.HeapSnapshotInstancesDataGridTree.prototype.set includeInternalObjects): Deleted.
+        * UserInterface/Views/HeapSnapshotSummaryContentView.js:
+        Remove the show/hide internal objects button. In the Instances view we will
+        only show non-Internal objects at the top level, and show internal objects
+        when those instances are expanded.
+
 2016-04-12  Matt Baker  <[email protected]>
 
         Web Inspector: clearing the console should exit all console groups

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -381,7 +381,6 @@
 localizedStrings["Height"] = "Height";
 localizedStrings["Hide Replay Controls"] = "Hide Replay Controls";
 localizedStrings["Hide compositing borders"] = "Hide compositing borders";
-localizedStrings["Hide internal objects"] = "Hide internal objects";
 localizedStrings["Hide shadow DOM nodes"] = "Hide shadow DOM nodes";
 localizedStrings["Hide the details sidebar (%s)"] = "Hide the details sidebar (%s)";
 localizedStrings["Hide the navigation sidebar (%s)"] = "Hide the navigation sidebar (%s)";
@@ -647,7 +646,6 @@
 localizedStrings["Show Source"] = "Show Source";
 localizedStrings["Show compositing borders"] = "Show compositing borders";
 localizedStrings["Show console tab"] = "Show console tab";
-localizedStrings["Show internal objects"] = "Show internal objects";
 localizedStrings["Show only resources with issues."] = "Show only resources with issues.";
 localizedStrings["Show resources with and without issues."] = "Show resources with and without issues.";
 localizedStrings["Show shadow DOM nodes"] = "Show shadow DOM nodes";

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Main.html	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html	2016-04-12 19:35:12 UTC (rev 199379)
@@ -524,9 +524,9 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
     <script src=""
     <script src=""
-    <script src=""
     <script src=""
     <script src=""
     <script src=""

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotRootPath.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotRootPath.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotRootPath.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -50,6 +50,26 @@
         return new WebInspector.HeapSnapshotRootPath(null);
     }
 
+    static pathComponentForIndividualEdge(edge)
+    {
+        switch (edge.type) {
+        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Internal:
+            return null;
+        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Index:
+            return "[" + edge.data + "]";
+        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Property:
+        case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Variable:
+            if (WebInspector.HeapSnapshotRootPath.canPropertyNameBeDotAccess(edge.data))
+                return edge.data;
+            return "[" + doubleQuotedString(edge.data) + "]";
+        }
+    }
+
+    static canPropertyNameBeDotAccess(propertyName)
+    {
+        return /^(?![0-9])\w+$/.test(propertyName);
+    }
+
     // Public
 
     get node() { return this._node; }
@@ -117,7 +137,7 @@
 
     appendPropertyName(node, propertyName)
     {
-        let component = this._canPropertyNameBeDotAccess(propertyName) ? "." + propertyName : "[" + doubleQuotedString(propertyName) + "]";
+        let component = WebInspector.HeapSnapshotRootPath.canPropertyNameBeDotAccess(propertyName) ? "." + propertyName : "[" + doubleQuotedString(propertyName) + "]";
         return new WebInspector.HeapSnapshotRootPath(node, component, this);
     }
 
@@ -151,13 +171,6 @@
 
         console.error("Unexpected edge type", edge.type);
     }
-
-    // Private
-
-    _canPropertyNameBeDotAccess(propertyName)
-    {
-        return /^(?![0-9])\w+$/.test(propertyName);
-    }
 };
 
 WebInspector.HeapSnapshotRootPath.SpecialPathComponent = {

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/PropertyPreview.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Models/PropertyPreview.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/PropertyPreview.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -29,7 +29,7 @@
     {
         super();
 
-        console.assert(name);
+        console.assert(typeof name === "string");
         console.assert(type);
         console.assert(!value || typeof value === "string");
         console.assert(!valuePreview || valuePreview instanceof WebInspector.ObjectPreview);

Modified: trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -25,7 +25,7 @@
 
 WebInspector.HeapSnapshotNodeProxy = class HeapSnapshotNodeProxy
 {
-    constructor(snapshotObjectId, identifier, className, size, retainedSize, internal, gcRoot)
+    constructor(snapshotObjectId, identifier, className, size, retainedSize, internal, gcRoot, hasChildren)
     {
         this._proxyObjectId = snapshotObjectId;
 
@@ -35,14 +35,15 @@
         this.retainedSize = retainedSize;
         this.internal = internal;
         this.gcRoot = gcRoot;
+        this.hasChildren = hasChildren;
     }
 
     // Static
 
     static deserialize(objectId, serializedNode)
     {
-        let {id, className, size, retainedSize, internal, gcRoot} = serializedNode;
-        return new WebInspector.HeapSnapshotNodeProxy(objectId, id, className, size, retainedSize, internal, gcRoot);
+        let {id, className, size, retainedSize, internal, gcRoot, hasChildren} = serializedNode;
+        return new WebInspector.HeapSnapshotNodeProxy(objectId, id, className, size, retainedSize, internal, gcRoot, hasChildren);
     }
 
     // Proxied
@@ -78,8 +79,10 @@
 
     retainedNodes(callback)
     {
-        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "retainedNodes", this.id, (serializedNodes) => {
-            callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId)));
+        WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "retainedNodes", this.id, ({retainedNodes: serializedNodes, edges: serializedEdges}) => {
+            let deserializedNodes = serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId));
+            let deserializedEdges = serializedEdges.map(WebInspector.HeapSnapshotEdgeProxy.deserialize.bind(null, this._proxyObjectId));
+            callback(deserializedNodes, deserializedEdges);
         });
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClassDataGridNode.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClassDataGridNode.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClassDataGridNode.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -60,10 +60,10 @@
             return Number.bytesToString(this._data.size);
 
         if (columnIdentifier === "className") {
-            let {className, allInternal} = this._data;
+            let {className} = this._data;
             let fragment = document.createDocumentFragment();
             let iconElement = fragment.appendChild(document.createElement("img"));
-            iconElement.classList.add("icon", WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(className, allInternal));
+            iconElement.classList.add("icon", WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(className));
             let nameElement = fragment.appendChild(document.createElement("span"));
             nameElement.classList.add("class-name");
             nameElement.textContent = className;
@@ -104,17 +104,13 @@
 
             // Batch.
             if (instances.length > WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit) {
-                // FIXME: This should respect the this._tree.includeInternalObjects setting.
                 this._batched = true;
                 this._fetchBatch(WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit);
                 return;
             }
 
-            for (let instance of this._instances) {
-                if (instance.internal && !this._tree.includeInternalObjects)
-                    continue;
+            for (let instance of this._instances)
                 this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance, this._tree));
-            }
         });
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClusterContentView.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClusterContentView.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotClusterContentView.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -44,14 +44,6 @@
         this._summaryContentView = null;
         this._instancesContentView = null;
 
-        if (!WebInspector.HeapSnapshotClusterContentView.showInternalObjectsSetting)
-            WebInspector.HeapSnapshotClusterContentView.showInternalObjectsSetting = new WebInspector.Setting("heap-snapshot-cluster-content-view-show-internal-objects", false);
-
-        // FIXME: Need an image for showing / hiding internal objects.
-        this._showInternalObjectsButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("show-internal-objects", WebInspector.UIString("Show internal objects"), WebInspector.UIString("Hide internal objects"), "Images/ShadowDOM.svg", 13, 13);
-        this._showInternalObjectsButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleShowInternalObjectsSetting, this);
-        this._updateShowInternalObjectsButtonNavigationItem();
-
         this._summaryPathComponent = createPathComponent.call(this, WebInspector.UIString("Summary"), "heap-snapshot-summary-icon", WebInspector.HeapSnapshotClusterContentView.SummaryIdentifier);
         this._instancesPathComponent = createPathComponent.call(this, WebInspector.UIString("Instances"), "heap-snapshot-instances-icon", WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier);
 
@@ -115,22 +107,17 @@
     get summaryContentView()
     {
         if (!this._summaryContentView)
-            this._summaryContentView = new WebInspector.HeapSnapshotSummaryContentView(this._heapSnapshot, this._contentViewExtraArguments());
+            this._summaryContentView = new WebInspector.HeapSnapshotSummaryContentView(this._heapSnapshot);
         return this._summaryContentView;
     }
 
     get instancesContentView()
     {
         if (!this._instancesContentView)
-            this._instancesContentView = new WebInspector.HeapSnapshotInstancesContentView(this._heapSnapshot, this._contentViewExtraArguments());
+            this._instancesContentView = new WebInspector.HeapSnapshotInstancesContentView(this._heapSnapshot);
         return this._instancesContentView;
     }
 
-    get navigationItems()
-    {
-        return [this._showInternalObjectsButtonNavigationItem];
-    }
-
     get selectionPathComponents()
     {
         let currentContentView = this._contentViewContainer.currentContentView;
@@ -145,10 +132,8 @@
     {
         super.shown();
 
-        if (this._shownInitialContent) {
-            this._updateViewsForShowInternalObjectsSettingValue();
+        if (this._shownInitialContent)
             return;
-        }
 
         this._showContentViewForIdentifier(this._currentContentViewSetting.value);
     }
@@ -184,11 +169,6 @@
 
     // Private
 
-    _contentViewExtraArguments()
-    {
-        return {showInternalObjects: WebInspector.HeapSnapshotClusterContentView.showInternalObjectsSetting.value};
-    }
-
     _pathComponentForContentView(contentView)
     {
         console.assert(contentView);
@@ -244,30 +224,6 @@
     {
         this._showContentViewForIdentifier(event.data.pathComponent.representedObject);
     }
-
-    _toggleShowInternalObjectsSetting(event)
-    {
-        WebInspector.HeapSnapshotClusterContentView.showInternalObjectsSetting.value = !WebInspector.HeapSnapshotClusterContentView.showInternalObjectsSetting.value;
-
-        this._updateViewsForShowInternalObjectsSettingValue();
-    }
-
-    _updateViewsForShowInternalObjectsSettingValue(force)
-    {
-        let value = WebInspector.HeapSnapshotClusterContentView.showInternalObjectsSetting.value;
-        if (this._showInternalObjectsButtonNavigationItem.activated === value)
-            return;
-
-        if (this._instancesContentView)
-            this._instancesContentView.showInternalObjects = value;
-
-        this._updateShowInternalObjectsButtonNavigationItem();
-    }
-
-    _updateShowInternalObjectsButtonNavigationItem()
-    {
-        this._showInternalObjectsButtonNavigationItem.activated = WebInspector.HeapSnapshotClusterContentView.showInternalObjectsSetting.value;
-    }
 };
 
 WebInspector.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey = "heap-snapshot-cluster-content-view-identifier";

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -25,17 +25,25 @@
 
 WebInspector.HeapSnapshotInstanceDataGridNode = class HeapSnapshotInstanceDataGridNode extends WebInspector.DataGridNode
 {
-    constructor(node, tree)
+    constructor(node, tree, edge)
     {
-        super(node, false);
+        // Don't treat strings as having child nodes, even if they have a Structure.
+        let hasChildren = node.hasChildren && node.className !== "string";
 
+        super(node, hasChildren);
+
         console.assert(node instanceof WebInspector.HeapSnapshotNodeProxy);
+        console.assert(!edge || edge instanceof WebInspector.HeapSnapshotEdgeProxy);
 
         this._node = node;
         this._tree = tree;
+        this._edge = edge || null;
 
         // FIXME: Make instance grid nodes copyable.
         this.copyable = false;
+
+        if (hasChildren)
+            this.addEventListener("populate", this._populate, this);
     }
 
     // Static
@@ -121,6 +129,15 @@
             let iconElement = containerElement.appendChild(document.createElement("img"));
             iconElement.classList.add("icon", WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(className, internal));
 
+            if (this._edge) {
+                let nameElement = containerElement.appendChild(document.createElement("span"));
+                let edgeText = WebInspector.HeapSnapshotRootPath.pathComponentForIndividualEdge(this._edge);
+                if (edgeText)
+                    nameElement.textContent = edgeText + ": " + this._node.className + " ";
+                else
+                    nameElement.textContent = this._node.className + " ";
+            }
+
             let idElement = containerElement.appendChild(document.createElement("span"));
             idElement.classList.add("object-id");
             idElement.textContent = "@" + id;
@@ -180,11 +197,39 @@
 
     sort()
     {
-        // No children to sort.
+        let children = this.children;
+        children.sort(this._tree._sortComparator);
+
+        for (let i = 0; i < children.length; ++i) {
+            children[i]._recalculateSiblings(i);
+            children[i].sort();
+        }
     }
 
     // Private
 
+    _populate()
+    {
+        this.removeEventListener("populate", this._populate, this);
+
+        this._node.retainedNodes((instances, edges) => {
+            // Reference edge from instance so we can get it after sorting.
+            for (let i = 0; i < instances.length; ++i)
+                instances[i].__edge = edges[i];
+
+            instances.sort((a, b) => {
+                let fakeDataGridNodeA = {data: a};
+                let fakeDataGridNodeB = {data: b};
+                return this._tree._sortComparator(fakeDataGridNodeA, fakeDataGridNodeB);
+            });
+
+            // FIXME: This should gracefully handle a node that references many objects.
+
+            for (let instance of instances)
+                this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance, this._tree, instance.__edge));
+        });        
+    }
+
     _contextMenuHandler(event)
     {
         let contextMenu = WebInspector.ContextMenu.createFromEvent(event);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstancesContentView.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstancesContentView.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstancesContentView.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -25,7 +25,7 @@
 
 WebInspector.HeapSnapshotInstancesContentView = class HeapSnapshotInstancesContentView extends WebInspector.ContentView
 {
-    constructor(representedObject, extraArguments)
+    constructor(representedObject)
     {
         console.assert(representedObject instanceof WebInspector.HeapSnapshotProxy || representedObject instanceof WebInspector.HeapSnapshotDiffProxy);
 
@@ -33,8 +33,6 @@
 
         this.element.classList.add("heap-snapshot");
 
-        let {showInternalObjects} = extraArguments;
-
         let columns = {
             retainedSize: {
                 title: WebInspector.UIString("Retained Size"),
@@ -68,7 +66,7 @@
         this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
 
         let sortComparator = WebInspector.HeapSnapshotInstancesDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier, this._dataGrid.sortOrder);
-        this._heapSnapshotDataGridTree = new WebInspector.HeapSnapshotInstancesDataGridTree(this.representedObject, sortComparator, showInternalObjects);
+        this._heapSnapshotDataGridTree = new WebInspector.HeapSnapshotInstancesDataGridTree(this.representedObject, sortComparator);
 
         for (let child of this._heapSnapshotDataGridTree.children)
             this._dataGrid.appendChild(child);
@@ -77,23 +75,6 @@
         this._dataGrid.updateLayout();
     }
 
-    // Public
-
-    get showInternalObjects()
-    {
-        return this._heapSnapshotDataGridTree.includeInternalObjects;
-    }
-
-    set showInternalObjects(showInternalObjects)
-    {
-        if (this.showInternalObjects === showInternalObjects)
-            return;
-
-        this._heapSnapshotDataGridTree.includeInternalObjects = showInternalObjects;
-
-        this._sortDataGrid();
-    }
-
     // Protected
 
     shown()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstancesDataGridTree.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstancesDataGridTree.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstancesDataGridTree.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -25,7 +25,7 @@
 
 WebInspector.HeapSnapshotInstancesDataGridTree = class HeapSnapshotInstancesDataGridTree extends WebInspector.Object
 {
-    constructor(heapSnapshot, sortComparator, includeInternalObjects)
+    constructor(heapSnapshot, sortComparator)
     {
         super();
 
@@ -35,7 +35,6 @@
 
         this._children = [];
         this._sortComparator = sortComparator;
-        this._includeInternalObjects = includeInternalObjects;
 
         this._visible = false;
         this._popover = null;
@@ -70,22 +69,6 @@
 
     get heapSnapshot() { return this._heapSnapshot; }
 
-    get includeInternalObjects()
-    {
-        return this._includeInternalObjects;
-    }
-
-    set includeInternalObjects(includeInternal)
-    {
-        if (this._includeInternalObjects === includeInternal)
-            return;
-
-        this._includeInternalObjects = includeInternal;
-
-        this._populateTopLevel();
-        this.sort();
-    }
-
     get visible()
     {
         return this._visible;
@@ -172,12 +155,11 @@
     {
         this.removeChildren();
 
-        // Populate the first level with the different classes.
+        // Populate the first level with the different non-internal classes.
         for (let [className, {size, retainedSize, count, internalCount}] of this._heapSnapshot.categories) {
-            let allInternal = count === internalCount;
-            if (!this._includeInternalObjects && allInternal)
+            if (count === internalCount)
                 continue;
-            this.appendChild(new WebInspector.HeapSnapshotClassDataGridNode({className, size, retainedSize, count, allInternal}, this));
+            this.appendChild(new WebInspector.HeapSnapshotClassDataGridNode({className, size, retainedSize, count}, this));
         }
     }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotSummaryContentView.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotSummaryContentView.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotSummaryContentView.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -25,7 +25,7 @@
 
 WebInspector.HeapSnapshotSummaryContentView = class HeapSnapshotSummaryContentView extends WebInspector.ContentView
 {
-    constructor(heapSnapshot, extraArguments)
+    constructor(heapSnapshot)
     {
         console.assert(heapSnapshot instanceof WebInspector.HeapSnapshotProxy || heapSnapshot instanceof WebInspector.HeapSnapshotDiffProxy);
 
@@ -33,9 +33,6 @@
 
         this._heapSnapshot = heapSnapshot;
 
-        // FIXME: Show/hide internal objects.
-        let {showInternalObjects} = extraArguments;
-
         this.element.classList.add("heap-snapshot-summary");
 
         let contentElement = this.element.appendChild(document.createElement("div"));

Modified: trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js (199378 => 199379)


--- trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js	2016-04-12 18:44:54 UTC (rev 199378)
+++ trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js	2016-04-12 19:35:12 UTC (rev 199379)
@@ -30,7 +30,7 @@
  */
 
 // nodes
-// [<0:id>, <1:size>, <2:classNameTableIndex>, <3:internal>];
+// [<0:id>, <1:size>, <2:classNameTableIndex>, <3:internal>]
 const nodeFieldCount = 4;
 const nodeIdOffset = 0;
 const nodeSizeOffset = 1;
@@ -213,7 +213,7 @@
                 instances.push(nodeIndex);
         }
 
-        return instances.map(snapshot.serializeNode.bind(snapshot));
+        return instances.map(snapshot.serializeNode, snapshot);
     }
 
     // Worker Methods
@@ -269,12 +269,13 @@
                 dominatedNodes.push(nodeOrdinal * nodeFieldCount);
         }
 
-        return dominatedNodes.map(this.serializeNode.bind(this));
+        return dominatedNodes.map(this.serializeNode, this);
     }
 
     retainedNodes(nodeIdentifier)
     {
         let retainedNodes = [];
+        let edges = [];
 
         let nodeOrdinal = this._nodeIdentifierToOrdinal.get(nodeIdentifier);
         let edgeIndex = this._nodeOrdinalToFirstOutgoingEdge[nodeOrdinal];
@@ -283,9 +284,13 @@
             let toNodeOrdinal = this._nodeIdentifierToOrdinal.get(toNodeIdentifier);
             let toNodeIndex = toNodeOrdinal * nodeFieldCount;
             retainedNodes.push(toNodeIndex);
+            edges.push(edgeIndex);
         }
 
-        return retainedNodes.map(this.serializeNode.bind(this));
+        return {
+            retainedNodes: retainedNodes.map(this.serializeNode, this),
+            edges: edges.map(this.serializeEdge, this),
+        };
     }
 
     retainers(nodeIdentifier)
@@ -301,7 +306,7 @@
             retainers.push(fromNodeIndex);
         }
 
-        return retainers.map(this.serializeNode.bind(this));
+        return retainers.map(this.serializeNode, this);
     }
 
     // Public
@@ -321,15 +326,19 @@
     {
         console.assert((nodeIndex % nodeFieldCount) === 0, "Invalid nodeIndex to serialize");
 
+        let nodeIdentifier = this._nodes[nodeIndex + nodeIdOffset];
         let nodeOrdinal = nodeIndex / nodeFieldCount;
+        let edgeIndex = this._nodeOrdinalToFirstOutgoingEdge[nodeOrdinal];
+        let hasChildren = this._edges[edgeIndex + edgeFromIdOffset] === nodeIdentifier;
 
         return {
-            id: this._nodes[nodeIndex + nodeIdOffset],
+            id: nodeIdentifier,
             className: this._nodeClassNamesTable[this._nodes[nodeIndex + nodeClassNameOffset]],
             size: this._nodes[nodeIndex + nodeSizeOffset],
             retainedSize: this._nodeOrdinalToRetainedSizes[nodeOrdinal],
             internal: this._nodes[nodeIndex + nodeInternalOffset] ? true : false,
             gcRoot: this._nodeOrdinalIsGCRoot[nodeOrdinal] ? true : false,
+            hasChildren,
         };
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to