Title: [197822] trunk
Revision
197822
Author
[email protected]
Date
2016-03-08 17:38:41 -0800 (Tue, 08 Mar 2016)

Log Message

Web Inspector: Add a way to create a Heap Snapshot
https://bugs.webkit.org/show_bug.cgi?id=155188

Patch by Joseph Pecoraro <[email protected]> on 2016-03-08
Reviewed by Brian Burg.

Source/_javascript_Core:

* inspector/agents/InspectorHeapAgent.h:
* inspector/protocol/Heap.json:
* inspector/agents/InspectorHeapAgent.cpp:
(Inspector::InspectorHeapAgent::snapshot):
Take a heap snapshot and return the JSON string result.

* inspector/protocol/Debugger.json:
Remove unused optional inferredName. Our displayName would be inferred.

Source/WebInspectorUI:

* UserInterface/Main.html:
* UserInterface/Test.html:
Add new Model resources.

* UserInterface/Models/HeapSnapshot.js: Added.
(WebInspector.HeapSnapshotClassCategory):
(WebInspector.HeapSnapshot):
(WebInspector.HeapSnapshot.fromPayload):
(WebInspector.HeapSnapshot.prototype.get rootNode):
(WebInspector.HeapSnapshot.prototype.get nodes):
(WebInspector.HeapSnapshot.prototype.get identifier):
(WebInspector.HeapSnapshot.prototype.get instances):
(WebInspector.HeapSnapshot.prototype.get categories):
(WebInspector.HeapSnapshot.prototype.get totalSize):
(WebInspector.HeapSnapshot.prototype.get totalObjectCount):
(WebInspector.HeapSnapshot.prototype.instancesWithClassName):
(WebInspector.HeapSnapshot.prototype.nodeWithObjectIdentifier):
* UserInterface/Models/HeapSnapshotEdge.js: Added.
(WebInspector.HeapSnapshotEdge):
(WebInspector.HeapSnapshotEdge.prototype.stringify):
* UserInterface/Models/HeapSnapshotNode.js: Added.
(WebInspector.HeapSnapshotNode):
Data structures for a HeapSnapshot.

LayoutTests:

* inspector/heap/snapshot-expected.txt: Added.
* inspector/heap/snapshot.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197821 => 197822)


--- trunk/LayoutTests/ChangeLog	2016-03-09 01:05:53 UTC (rev 197821)
+++ trunk/LayoutTests/ChangeLog	2016-03-09 01:38:41 UTC (rev 197822)
@@ -1,3 +1,13 @@
+2016-03-08  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Add a way to create a Heap Snapshot
+        https://bugs.webkit.org/show_bug.cgi?id=155188
+
+        Reviewed by Brian Burg.
+
+        * inspector/heap/snapshot-expected.txt: Added.
+        * inspector/heap/snapshot.html: Added.
+
 2016-03-08  Ryan Haddad  <[email protected]>
 
         Move two indexeddb test skips out of wk2/TestExpectations and in to TestExpectations.

Added: trunk/LayoutTests/inspector/heap/snapshot-expected.txt (0 => 197822)


--- trunk/LayoutTests/inspector/heap/snapshot-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/heap/snapshot-expected.txt	2016-03-09 01:38:41 UTC (rev 197822)
@@ -0,0 +1,11 @@
+Test for the Heap.snapshot command.
+
+
+== Running test suite: Heap.snapshot
+-- Running test case: TriggerSnapshot
+PASS: Should not have an error creating a snapshot.
+PASS: Snapshot size should be greater than 1kb.
+PASS: Snapshot object count should be greater than 100.
+PASS: Snapshot should include a class category for 'Window'.
+PASS: Snapshow should include at least one 'Window' instance.
+

Added: trunk/LayoutTests/inspector/heap/snapshot.html (0 => 197822)


--- trunk/LayoutTests/inspector/heap/snapshot.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/heap/snapshot.html	2016-03-09 01:38:41 UTC (rev 197822)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite("Heap.snapshot");
+
+    suite.addTestCase({
+        name: "TriggerSnapshot",
+        description: "Calling Heap.snapshot should create a heap snapshot.",
+        test: (resolve, reject) => {
+            HeapAgent.snapshot((error, timestamp, snapshotStringData) => {
+                InspectorTest.expectThat(!error, "Should not have an error creating a snapshot.");
+                let payload = JSON.parse(snapshotStringData);
+                let snapshot = WebInspector.HeapSnapshot.fromPayload(payload);
+                InspectorTest.expectThat(snapshot.totalSize > 1024, "Snapshot size should be greater than 1kb.");
+                InspectorTest.expectThat(snapshot.totalObjectCount > 100, "Snapshot object count should be greater than 100.");
+                InspectorTest.expectThat(snapshot.categories.get("Window"), "Snapshot should include a class category for 'Window'.");
+                InspectorTest.expectThat(snapshot.instancesWithClassName("Window").length > 0, "Snapshow should include at least one 'Window' instance.");
+                resolve();
+            });
+        }
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Test for the Heap.snapshot command.</p>
+</body>
+</html>

Modified: trunk/Source/_javascript_Core/ChangeLog (197821 => 197822)


--- trunk/Source/_javascript_Core/ChangeLog	2016-03-09 01:05:53 UTC (rev 197821)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-03-09 01:38:41 UTC (rev 197822)
@@ -1,3 +1,19 @@
+2016-03-08  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Add a way to create a Heap Snapshot
+        https://bugs.webkit.org/show_bug.cgi?id=155188
+
+        Reviewed by Brian Burg.
+
+        * inspector/agents/InspectorHeapAgent.h:
+        * inspector/protocol/Heap.json:
+        * inspector/agents/InspectorHeapAgent.cpp:
+        (Inspector::InspectorHeapAgent::snapshot):
+        Take a heap snapshot and return the JSON string result.
+
+        * inspector/protocol/Debugger.json:
+        Remove unused optional inferredName. Our displayName would be inferred.
+
 2016-03-08  Oliver Hunt  <[email protected]>
 
         Fix ios bot build.

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp (197821 => 197822)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp	2016-03-09 01:05:53 UTC (rev 197821)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp	2016-03-09 01:38:41 UTC (rev 197822)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,7 +26,9 @@
 #include "config.h"
 #include "InspectorHeapAgent.h"
 
+#include "HeapProfiler.h"
 #include "InspectorEnvironment.h"
+#include "JSCInlines.h"
 #include "VM.h"
 #include <wtf/RunLoop.h>
 #include <wtf/Stopwatch.h>
@@ -75,6 +77,8 @@
     m_enabled = false;
 
     m_environment.vm().heap.removeObserver(this);
+
+    clearHeapSnapshots();
 }
 
 void InspectorHeapAgent::gc(ErrorString&)
@@ -85,6 +89,26 @@
     vm.heap.collectAllGarbage();
 }
 
+void InspectorHeapAgent::snapshot(ErrorString&, double* timestamp, String* snapshotData)
+{
+    VM& vm = m_environment.vm();
+    JSLockHolder lock(vm);
+
+    HeapSnapshotBuilder snapshotBuilder(vm.ensureHeapProfiler());
+    snapshotBuilder.buildSnapshot();
+
+    *timestamp = m_environment.executionStopwatch()->elapsedTime();
+    *snapshotData = snapshotBuilder.json([&] (const HeapSnapshotNode& node) {
+        if (Structure* structure = node.cell->structure(vm)) {
+            if (JSGlobalObject* globalObject = structure->globalObject()) {
+                if (!m_environment.canAccessInspectedScriptState(globalObject->globalExec()))
+                    return false;
+            }
+        }
+        return true;
+    });
+}
+
 static Inspector::Protocol::Heap::GarbageCollection::Type protocolTypeForHeapOperation(HeapOperation operation)
 {
     switch (operation) {
@@ -136,4 +160,10 @@
     m_gcStartTime = NAN;
 }
 
+void InspectorHeapAgent::clearHeapSnapshots()
+{
+    if (HeapProfiler* heapProfiler = m_environment.vm().heapProfiler())
+        heapProfiler->clearSnapshots();
+}
+
 } // namespace Inspector

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h (197821 => 197822)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h	2016-03-09 01:05:53 UTC (rev 197821)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h	2016-03-09 01:38:41 UTC (rev 197822)
@@ -26,6 +26,7 @@
 #ifndef InspectorHeapAgent_h
 #define InspectorHeapAgent_h
 
+#include "HeapSnapshot.h"
 #include "InspectorBackendDispatchers.h"
 #include "InspectorFrontendDispatchers.h"
 #include "heap/HeapObserver.h"
@@ -50,15 +51,19 @@
     void enable(ErrorString&) override;
     void disable(ErrorString&) override;
     void gc(ErrorString&) override;
+    void snapshot(ErrorString&, double* timestamp, String* snapshotData) override;
 
     // HeapObserver
     void willGarbageCollect() override;
     void didGarbageCollect(JSC::HeapOperation) override;
 
 private:
+    void clearHeapSnapshots();
+
     std::unique_ptr<HeapFrontendDispatcher> m_frontendDispatcher;
     RefPtr<HeapBackendDispatcher> m_backendDispatcher;
     InspectorEnvironment& m_environment;
+
     bool m_enabled { false };
     double m_gcStartTime { NAN };
 };

Modified: trunk/Source/_javascript_Core/inspector/protocol/Debugger.json (197821 => 197822)


--- trunk/Source/_javascript_Core/inspector/protocol/Debugger.json	2016-03-09 01:05:53 UTC (rev 197821)
+++ trunk/Source/_javascript_Core/inspector/protocol/Debugger.json	2016-03-09 01:38:41 UTC (rev 197822)
@@ -60,7 +60,6 @@
                 { "name": "location", "$ref": "Location", "description": "Location of the function." },
                 { "name": "name", "type": "string", "optional": true, "description": "Name of the function. Not present for anonymous functions." },
                 { "name": "displayName", "type": "string", "optional": true, "description": "Display name of the function(specified in 'displayName' property on the function object)." },
-                { "name": "inferredName", "type": "string", "optional": true, "description": "Name of the function inferred from its initial assignment." },
                 { "name": "scopeChain", "type": "array", "optional": true, "items": { "$ref": "Scope" }, "description": "Scope chain for this closure." }
             ],
             "description": "Information about the function."

Modified: trunk/Source/_javascript_Core/inspector/protocol/Heap.json (197821 => 197822)


--- trunk/Source/_javascript_Core/inspector/protocol/Heap.json	2016-03-09 01:05:53 UTC (rev 197821)
+++ trunk/Source/_javascript_Core/inspector/protocol/Heap.json	2016-03-09 01:38:41 UTC (rev 197822)
@@ -11,6 +11,11 @@
                 { "name": "startTime", "type": "number" },
                 { "name": "endTime", "type": "number" }
             ]
+        },
+        {
+            "id": "HeapSnapshotData",
+            "description": "_javascript_Core HeapSnapshot JSON data.",
+            "type": "string"
         }
     ],
     "commands": [
@@ -25,6 +30,14 @@
         {
             "name": "gc",
             "description": "Trigger a full garbage collection."
+        },
+        {
+            "name": "snapshot",
+            "description": "Take a heap snapshot.",
+            "returns": [
+                { "name": "timestamp", "type": "number" },
+                { "name": "snapshotData", "$ref": "HeapSnapshotData" }
+            ]
         }
     ],
     "events": [

Modified: trunk/Source/WebInspectorUI/ChangeLog (197821 => 197822)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-03-09 01:05:53 UTC (rev 197821)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-03-09 01:38:41 UTC (rev 197822)
@@ -1,5 +1,36 @@
 2016-03-08  Joseph Pecoraro  <[email protected]>
 
+        Web Inspector: Add a way to create a Heap Snapshot
+        https://bugs.webkit.org/show_bug.cgi?id=155188
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Main.html:
+        * UserInterface/Test.html:
+        Add new Model resources.
+
+        * UserInterface/Models/HeapSnapshot.js: Added.
+        (WebInspector.HeapSnapshotClassCategory):
+        (WebInspector.HeapSnapshot):
+        (WebInspector.HeapSnapshot.fromPayload):
+        (WebInspector.HeapSnapshot.prototype.get rootNode):
+        (WebInspector.HeapSnapshot.prototype.get nodes):
+        (WebInspector.HeapSnapshot.prototype.get identifier):
+        (WebInspector.HeapSnapshot.prototype.get instances):
+        (WebInspector.HeapSnapshot.prototype.get categories):
+        (WebInspector.HeapSnapshot.prototype.get totalSize):
+        (WebInspector.HeapSnapshot.prototype.get totalObjectCount):
+        (WebInspector.HeapSnapshot.prototype.instancesWithClassName):
+        (WebInspector.HeapSnapshot.prototype.nodeWithObjectIdentifier):
+        * UserInterface/Models/HeapSnapshotEdge.js: Added.
+        (WebInspector.HeapSnapshotEdge):
+        (WebInspector.HeapSnapshotEdge.prototype.stringify):
+        * UserInterface/Models/HeapSnapshotNode.js: Added.
+        (WebInspector.HeapSnapshotNode):
+        Data structures for a HeapSnapshot.
+
+2016-03-08  Joseph Pecoraro  <[email protected]>
+
         Web Inspector: Miscellaneous inspector fixes for typos / stale code
         https://bugs.webkit.org/show_bug.cgi?id=155193
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (197821 => 197822)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2016-03-09 01:05:53 UTC (rev 197821)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2016-03-09 01:38:41 UTC (rev 197822)
@@ -94,6 +94,17 @@
     }
 });
 
+Object.defineProperty(Map, "fromObject",
+{
+    value: function(object)
+    {
+        let map = new Map;
+        for (let key in object)
+            map.set(key, object[key]);
+        return map;
+    }
+});
+
 Object.defineProperty(Map.prototype, "take",
 {
     value: function(key)

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (197821 => 197822)


--- trunk/Source/WebInspectorUI/UserInterface/Main.html	2016-03-09 01:05:53 UTC (rev 197821)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html	2016-03-09 01:38:41 UTC (rev 197822)
@@ -308,6 +308,9 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
+    <script src=""
+    <script src=""
     <script src=""
     <script src=""
     <script src=""

Added: trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshot.js (0 => 197822)


--- trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshot.js	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshot.js	2016-03-09 01:38:41 UTC (rev 197822)
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.HeapSnapshotClassCategory = class HeapSnapshotClassCategory
+{
+    constructor(className)
+    {
+        this.className = className;
+        this.size = 0;
+        this.count = 0;
+        this.internalCount = 0;
+    }
+};
+
+WebInspector.HeapSnapshot = class HeapSnapshot extends WebInspector.Object
+{
+    constructor(rootNode, nodes, nodeMap)
+    {
+        super();
+
+        console.assert(!rootNode || rootNode instanceof WebInspector.HeapSnapshotNode);
+        console.assert(nodes instanceof Array);
+
+        this._rootNode = rootNode;
+        this._nodes = nodes;
+        this._nodeMap = nodeMap;
+
+        this._identifier = WebInspector.HeapSnapshot._nextAvailableSnapshotIdentifier++;
+        this._instances = nodes;
+
+        let categories = {};
+        for (let i = 0; i < nodes.length; ++i) {
+            let {className, size, internal} = nodes[i];
+
+            let category = categories[className];
+            if (!category)
+                category = categories[className] = new WebInspector.HeapSnapshotClassCategory(className);
+
+            category.size += size;
+            category.count++;
+            if (internal)
+                category.internalCount++;
+        }
+        this._categories = Map.fromObject(categories);
+
+        this._totalSize = 0;
+        this._totalObjectCount = 0;
+        for (let {count, size} of this._categories.values()) {
+            this._totalSize += size;
+            this._totalObjectCount += count;
+        }
+    }
+
+    // Static
+
+    static fromPayload(payload)
+    {
+        let {version, nodes, nodeClassNames, edges, edgeTypes} = payload;
+        console.assert(version === 1, "Only know how to handle _javascript_Core Heap Snapshot Format Version 1");
+        console.assert(edgeTypes.every((type) => type in WebInspector.HeapSnapshotEdge.EdgeType), "Unexpected edge type", edgeTypes);
+
+        let nodeMap = new Map;
+
+        // Turn nodes into real nodes.
+        for (let i = 0, length = nodes.length; i < length; ++i) {
+            let nodePayload = nodes[i];
+            let id = nodePayload[0];
+            let size = nodePayload[1];
+            let classNameIndex = nodePayload[2];
+            let internal = nodePayload[3];
+
+            let node = new WebInspector.HeapSnapshotNode(id, nodeClassNames[classNameIndex], size, !!internal);
+            nodeMap.set(id, node);
+            nodes[i] = node;
+        }
+
+        // Turn edges into real edges and set them on the nodes.
+        for (let i = 0, length = edges.length; i < length; ++i) {
+            let edgePayload = edges[i];
+            let fromIdentifier = edgePayload[0];
+            let toIdentifier = edgePayload[1];
+            let edgeTypeIndex = edgePayload[2];
+            let data = ""
+
+            let from = nodeMap.get(fromIdentifier);
+            let to = nodeMap.get(toIdentifier);
+            let edge = new WebInspector.HeapSnapshotEdge(from, to, edgeTypes[edgeTypeIndex], data);
+            from.outgoingEdges.push(edge);
+            to.incomingEdges.push(edge);
+        }
+
+        // Root node.
+        let rootNode = nodeMap.get(0);
+        console.assert(rootNode, "Node with identifier 0 is the synthetic <root> node.");
+        console.assert(rootNode.outgoingEdges.length > 0, "This had better have children!");
+        console.assert(rootNode.incomingEdges.length === 0, "This had better not have back references!");
+
+        // Mark GC roots.
+        let rootNodeEdges = rootNode.outgoingEdges;
+        for (let i = 0, length = rootNodeEdges.length; i < length; ++i)
+            rootNodeEdges[i].to.gcRoot = true;
+
+        return new WebInspector.HeapSnapshot(rootNode, nodes, nodeMap);
+    }
+
+    // Public
+
+    get rootNode() { return this._rootNode; }
+    get nodes() { return this._nodes; }
+    get identifier() { return this._identifier; }
+    get instances() { return this._instances; }
+    get categories() { return this._categories; }
+    get totalSize() { return this._totalSize; }
+    get totalObjectCount() { return this._totalObjectCount; }
+
+    instancesWithClassName(className)
+    {
+        let results = [];
+        for (let i = 0; i < this._instances.length; ++i) {
+            let cell = this._instances[i];
+            if (cell.className === className)
+                results.push(cell);
+        }
+        return results;
+    }
+
+    nodeWithObjectIdentifier(id)
+    {
+        return this._nodeMap.get(id);
+    }
+};
+
+WebInspector.HeapSnapshot._nextAvailableSnapshotIdentifier = 1;

Added: trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotEdge.js (0 => 197822)


--- trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotEdge.js	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotEdge.js	2016-03-09 01:38:41 UTC (rev 197822)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Directed edge between two HeapSnapshotNodes 'from' and 'to'.
+
+WebInspector.HeapSnapshotEdge = class HeapSnapshotEdge
+{
+    constructor(from, to, type, data)
+    {
+        this.from = from;
+        this.to = to;
+        this.type = type;
+        this.data = ""
+    }
+};
+
+WebInspector.HeapSnapshotEdge.EdgeType = {
+    Internal: "Internal",       // No data.
+    Property: "Property",       // data is string property name.
+    Index: "Index",             // data is numeric index.
+    Variable: "Variable",       // data is string variable name.
+};

Added: trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotNode.js (0 => 197822)


--- trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotNode.js	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/HeapSnapshotNode.js	2016-03-09 01:38:41 UTC (rev 197822)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.HeapSnapshotNode = class HeapSnapshotNode
+{
+    constructor(identifier, className, size, internal)
+    {
+        this.id = identifier;
+        this.className = className;
+        this.size = size; 
+        this.internal = internal;
+        this.gcRoot = false;
+        this.outgoingEdges = [];
+        this.incomingEdges = [];
+    }
+};

Modified: trunk/Source/WebInspectorUI/UserInterface/Test.html (197821 => 197822)


--- trunk/Source/WebInspectorUI/UserInterface/Test.html	2016-03-09 01:05:53 UTC (rev 197821)
+++ trunk/Source/WebInspectorUI/UserInterface/Test.html	2016-03-09 01:38:41 UTC (rev 197822)
@@ -112,6 +112,9 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
+    <script src=""
+    <script src=""
     <script src=""
     <script src=""
     <script src=""
@@ -119,6 +122,9 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
+    <script src=""
+    <script src=""
     <script src=""
     <script src=""
     <script src=""
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to