Diff
Modified: trunk/Source/WebCore/ChangeLog (140389 => 140390)
--- trunk/Source/WebCore/ChangeLog 2013-01-22 08:02:36 UTC (rev 140389)
+++ trunk/Source/WebCore/ChangeLog 2013-01-22 08:10:10 UTC (rev 140390)
@@ -1,3 +1,93 @@
+2013-01-22 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: reuse JS heap profiler UI for native heap graph representaion
+ https://bugs.webkit.org/show_bug.cgi?id=107452
+
+ Reviewed by Pavel Feldman.
+
+ NativeHeapSnapshot is introduced to leverage JS heap snapshot processing algorithms
+ for native heap graph. New snapshot type ("Native Heap Snapshot") is added to the
+ profiles panel. It will represent native heap snapshots using the same UI as we use
+ for JS heap snapshots.
+
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * inspector/compile-front-end.py:
+ * inspector/front-end/HeapSnapshot.js:
+ (WebInspector.HeapSnapshot):
+ (WebInspector.HeapSnapshot.prototype._init):
+ * inspector/front-end/HeapSnapshotProxy.js:
+ (WebInspector.HeapSnapshotWorker):
+ * inspector/front-end/HeapSnapshotView.js:
+ (WebInspector.HeapProfileHeader.prototype.load):
+ (WebInspector.HeapProfileHeader.prototype.startSnapshotTransfer): extracted a few methods
+ to support overrides for native heap snapshots.
+ (WebInspector.HeapProfileHeader.prototype.snapshotConstructorName):
+ (WebInspector.HeapProfileHeader.prototype._setupWorker):
+ * inspector/front-end/NativeHeapSnapshot.js: Added.
+ (WebInspector.NativeHeapSnapshot):
+ (WebInspector.NativeHeapSnapshot.prototype.createNode):
+ (WebInspector.NativeHeapSnapshot.prototype.createEdge):
+ (WebInspector.NativeHeapSnapshot.prototype.createRetainingEdge):
+ (WebInspector.NativeHeapSnapshot.prototype._markInvisibleEdges):
+ (WebInspector.NativeHeapSnapshot.prototype._calculateFlags):
+ (WebInspector.NativeHeapSnapshot.prototype.canHaveDistanceOne):
+ (WebInspector.NativeHeapSnapshot.prototype.userObjectsMapAndFlag):
+ (WebInspector.NativeHeapSnapshotNode):
+ (WebInspector.NativeHeapSnapshotNode.prototype.canBeQueried):
+ (WebInspector.NativeHeapSnapshotNode.prototype.isUserObject):
+ (WebInspector.NativeHeapSnapshotNode.prototype.className):
+ (WebInspector.NativeHeapSnapshotNode.prototype.classIndex):
+ (WebInspector.NativeHeapSnapshotNode.prototype.id):
+ (WebInspector.NativeHeapSnapshotNode.prototype.name):
+ (WebInspector.NativeHeapSnapshotNode.prototype.isHidden):
+ (WebInspector.NativeHeapSnapshotNode.prototype.isSynthetic):
+ (WebInspector.NativeHeapSnapshotNode.prototype.isWindow):
+ (WebInspector.NativeHeapSnapshotNode.prototype.isDetachedDOMTreesRoot):
+ (WebInspector.NativeHeapSnapshotNode.prototype.isDetachedDOMTree):
+ (WebInspector.NativeHeapSnapshotEdge):
+ (WebInspector.NativeHeapSnapshotEdge.prototype.clone):
+ (WebInspector.NativeHeapSnapshotEdge.prototype.hasStringName):
+ (WebInspector.NativeHeapSnapshotEdge.prototype.isElement):
+ (WebInspector.NativeHeapSnapshotEdge.prototype.isHidden):
+ (WebInspector.NativeHeapSnapshotEdge.prototype.isWeak):
+ (WebInspector.NativeHeapSnapshotEdge.prototype.isInternal):
+ (WebInspector.NativeHeapSnapshotEdge.prototype.isInvisible):
+ (WebInspector.NativeHeapSnapshotEdge.prototype.isShortcut):
+ (WebInspector.NativeHeapSnapshotEdge.prototype.name):
+ (WebInspector.NativeHeapSnapshotEdge.prototype.toString):
+ (WebInspector.NativeHeapSnapshotEdge.prototype._nameOrIndex):
+ (WebInspector.NativeHeapSnapshotRetainerEdge):
+ (WebInspector.NativeHeapSnapshotRetainerEdge.prototype.clone):
+ (WebInspector.NativeHeapSnapshotRetainerEdge.prototype.isElement):
+ (WebInspector.NativeHeapSnapshotRetainerEdge.prototype.isHidden):
+ (WebInspector.NativeHeapSnapshotRetainerEdge.prototype.isInternal):
+ (WebInspector.NativeHeapSnapshotRetainerEdge.prototype.isInvisible):
+ (WebInspector.NativeHeapSnapshotRetainerEdge.prototype.isShortcut):
+ (WebInspector.NativeHeapSnapshotRetainerEdge.prototype.isWeak):
+ * inspector/front-end/NativeMemorySnapshotView.js:
+ (WebInspector.NativeSnapshotProfileType):
+ (WebInspector.NativeSnapshotProfileType.prototype.get buttonTooltip):
+ (WebInspector.NativeSnapshotProfileType.prototype.buttonClicked.didReceiveMemorySnapshot):
+ (WebInspector.NativeSnapshotProfileType.prototype.buttonClicked):
+ (WebInspector.NativeSnapshotProfileType.prototype.get treeItemTitle):
+ (WebInspector.NativeSnapshotProfileType.prototype.get description):
+ (WebInspector.NativeSnapshotProfileType.prototype.createTemporaryProfile):
+ (WebInspector.NativeSnapshotProfileType.prototype.createProfile):
+ (WebInspector.NativeSnapshotProfileHeader):
+ (WebInspector.NativeSnapshotProfileHeader.prototype.createView):
+ (WebInspector.NativeSnapshotProfileHeader.prototype.startSnapshotTransfer):
+ (WebInspector.NativeSnapshotProfileHeader.prototype.snapshotConstructorName):
+ (WebInspector.NativeSnapshotProfileHeader.prototype._takeNativeSnapshot): build a datastructure
+ resembling one used for JS heap snapshots but populated with the data from the native snaphot.
+ (WebInspector.NativeHeapSnapshotView):
+ (WebInspector.NativeHeapSnapshotView.prototype.get profile):
+ (WebInspector.NativeMemoryProfileType):
+ (WebInspector.NativeMemoryProfileType.prototype.get buttonTooltip):
+ * inspector/front-end/ProfilesPanel.js:
+ (WebInspector.ProfilesPanel):
+ * inspector/front-end/WebKit.qrc:
+
2013-01-21 Kentaro Hara <[email protected]>
[V8] ScriptState::isolate() should use Context::GetIsolate()
Modified: trunk/Source/WebCore/WebCore.gypi (140389 => 140390)
--- trunk/Source/WebCore/WebCore.gypi 2013-01-22 08:02:36 UTC (rev 140389)
+++ trunk/Source/WebCore/WebCore.gypi 2013-01-22 08:10:10 UTC (rev 140390)
@@ -5385,6 +5385,7 @@
'inspector/front-end/HeapSnapshotWorkerDispatcher.js',
'inspector/front-end/JSHeapSnapshot.js',
'inspector/front-end/NativeHeapGraph.js',
+ 'inspector/front-end/NativeHeapSnapshot.js',
'inspector/front-end/NativeMemorySnapshotView.js',
'inspector/front-end/ProfileDataGridTree.js',
'inspector/front-end/ProfilesPanel.js',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (140389 => 140390)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2013-01-22 08:02:36 UTC (rev 140389)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2013-01-22 08:10:10 UTC (rev 140390)
@@ -77269,6 +77269,10 @@
>
</File>
<File
+ RelativePath="..\inspector\front-end\NativeHeapSnapshot.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\nativeMemoryProfiler.css"
>
</File>
Modified: trunk/Source/WebCore/inspector/compile-front-end.py (140389 => 140390)
--- trunk/Source/WebCore/inspector/compile-front-end.py 2013-01-22 08:02:36 UTC (rev 140389)
+++ trunk/Source/WebCore/inspector/compile-front-end.py 2013-01-22 08:10:10 UTC (rev 140390)
@@ -339,6 +339,7 @@
"HeapSnapshotWorkerDispatcher.js",
"JSHeapSnapshot.js",
"NativeHeapGraph.js",
+ "NativeHeapSnapshot.js",
"NativeMemorySnapshotView.js",
"ProfileDataGridTree.js",
"ProfilesPanel.js",
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (140389 => 140390)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2013-01-22 08:02:36 UTC (rev 140389)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2013-01-22 08:10:10 UTC (rev 140390)
@@ -493,6 +493,10 @@
this._metaNode = profile.snapshot.meta;
this._strings = profile.strings;
+ this._rootNodeIndex = 0;
+ if (profile.snapshot.root_index)
+ this._rootNodeIndex = profile.snapshot.root_index;
+
this._snapshotDiffs = {};
this._aggregatesForDiff = null;
@@ -532,7 +536,6 @@
_init: function()
{
var meta = this._metaNode;
- this._rootNodeIndex = 0;
this._nodeTypeOffset = meta.node_fields.indexOf("type");
this._nodeNameOffset = meta.node_fields.indexOf("name");
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js (140389 => 140390)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js 2013-01-22 08:02:36 UTC (rev 140389)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js 2013-01-22 08:10:10 UTC (rev 140390)
@@ -859,12 +859,22 @@
this._setupWorker();
this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026");
this.sidebarElement.wait = true;
- ProfilerAgent.getHeapSnapshot(this.uid);
+ this.startSnapshotTransfer();
}
var loaderProxy = /** @type {WebInspector.HeapSnapshotLoaderProxy} */ (this._receiver);
loaderProxy.addConsumer(callback);
},
+ startSnapshotTransfer: function()
+ {
+ ProfilerAgent.getHeapSnapshot(this.uid);
+ },
+
+ snapshotConstructorName: function()
+ {
+ return "JSHeapSnapshot";
+ },
+
_setupWorker: function()
{
function setProfileWait(event)
@@ -873,7 +883,7 @@
}
var worker = new WebInspector.HeapSnapshotWorker();
worker.addEventListener("wait", setProfileWait, this);
- var loaderProxy = worker.createLoader("JSHeapSnapshot");
+ var loaderProxy = worker.createLoader(this.snapshotConstructorName());
loaderProxy.addConsumer(this._snapshotReceived.bind(this));
this._receiver = loaderProxy;
},
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotWorker.js (140389 => 140390)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotWorker.js 2013-01-22 08:02:36 UTC (rev 140389)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotWorker.js 2013-01-22 08:10:10 UTC (rev 140390)
@@ -35,6 +35,7 @@
importScripts("HeapSnapshotLoader.js");
importScripts("HeapSnapshotWorkerDispatcher.js");
importScripts("JSHeapSnapshot.js");
+importScripts("NativeHeapSnapshot.js");
importScripts("FileUtils.js");
importScripts("utilities.js");
Added: trunk/Source/WebCore/inspector/front-end/NativeHeapSnapshot.js (0 => 140390)
--- trunk/Source/WebCore/inspector/front-end/NativeHeapSnapshot.js (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/NativeHeapSnapshot.js 2013-01-22 08:10:10 UTC (rev 140390)
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2013 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+ */
+
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshot}
+ */
+WebInspector.NativeHeapSnapshot = function(profile)
+{
+ WebInspector.HeapSnapshot.call(this, profile);
+}
+
+WebInspector.NativeHeapSnapshot.prototype = {
+ createNode: function(nodeIndex)
+ {
+ return new WebInspector.NativeHeapSnapshotNode(this, nodeIndex);
+ },
+
+ createEdge: function(edges, edgeIndex)
+ {
+ return new WebInspector.NativeHeapSnapshotEdge(this, edges, edgeIndex);
+ },
+
+ createRetainingEdge: function(retainedNodeIndex, retainerIndex)
+ {
+ return new WebInspector.NativeHeapSnapshotRetainerEdge(this, retainedNodeIndex, retainerIndex);
+ },
+
+ _markInvisibleEdges: function()
+ {
+ },
+
+ _calculateFlags: function()
+ {
+ },
+
+ canHaveDistanceOne: function(node)
+ {
+ return true;
+ },
+
+ userObjectsMapAndFlag: function()
+ {
+ return null;
+ },
+
+ __proto__: WebInspector.HeapSnapshot.prototype
+};
+
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotNode}
+ * @param {WebInspector.NativeHeapSnapshot} snapshot
+ * @param {number=} nodeIndex
+ */
+WebInspector.NativeHeapSnapshotNode = function(snapshot, nodeIndex)
+{
+ WebInspector.HeapSnapshotNode.call(this, snapshot, nodeIndex)
+}
+
+WebInspector.NativeHeapSnapshotNode.prototype = {
+ canBeQueried: function()
+ {
+ return false;
+ },
+
+ isUserObject: function()
+ {
+ return true;
+ },
+
+ className: function()
+ {
+ return this._snapshot._strings[this.classIndex()];
+ },
+
+ classIndex: function()
+ {
+ var snapshot = this._snapshot;
+ return snapshot._nodes[this.nodeIndex + snapshot._nodeNameOffset];
+ },
+
+ id: function()
+ {
+ return this.nodeIndex;
+ },
+
+ name: function()
+ {
+ var name = this._snapshot._strings[this._snapshot._nodes[this.nodeIndex + 2]];
+ return this.className() + ": " + name;
+ },
+
+ isHidden: function()
+ {
+ return false;
+ },
+
+ isSynthetic: function()
+ {
+ return false;
+ },
+
+ isWindow: function()
+ {
+ return false;
+ },
+
+ isDetachedDOMTreesRoot: function()
+ {
+ return false;
+ },
+
+ isDetachedDOMTree: function()
+ {
+ return false;
+ },
+
+ __proto__: WebInspector.HeapSnapshotNode.prototype
+};
+
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotEdge}
+ * @param {WebInspector.NativeHeapSnapshot} snapshot
+ * @param {Array.<number>} edges
+ * @param {number=} edgeIndex
+ */
+WebInspector.NativeHeapSnapshotEdge = function(snapshot, edges, edgeIndex)
+{
+ WebInspector.HeapSnapshotEdge.call(this, snapshot, edges, edgeIndex);
+}
+
+WebInspector.NativeHeapSnapshotEdge.prototype = {
+ clone: function()
+ {
+ return new WebInspector.NativeHeapSnapshotEdge(this._snapshot, this._edges, this.edgeIndex);
+ },
+
+ hasStringName: function()
+ {
+ return true;
+ },
+
+ isElement: function()
+ {
+ return false;
+ },
+
+ isHidden: function()
+ {
+ return false;
+ },
+
+ isWeak: function()
+ {
+ return false;
+ },
+
+ isInternal: function()
+ {
+ return false;
+ },
+
+ isInvisible: function()
+ {
+ return false;
+ },
+
+ isShortcut: function()
+ {
+ return false;
+ },
+
+ name: function()
+ {
+ return this._snapshot._strings[this._nameOrIndex()];
+ },
+
+ toString: function()
+ {
+ return "NativeHeapSnapshotEdge: " + this.name();
+ },
+
+ _nameOrIndex: function()
+ {
+ return this._edges.item(this.edgeIndex + this._snapshot._edgeNameOffset);
+ },
+
+ __proto__: WebInspector.HeapSnapshotEdge.prototype
+};
+
+
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotRetainerEdge}
+ * @param {WebInspector.NativeHeapSnapshot} snapshot
+ */
+WebInspector.NativeHeapSnapshotRetainerEdge = function(snapshot, retainedNodeIndex, retainerIndex)
+{
+ WebInspector.HeapSnapshotRetainerEdge.call(this, snapshot, retainedNodeIndex, retainerIndex);
+}
+
+WebInspector.NativeHeapSnapshotRetainerEdge.prototype = {
+ clone: function()
+ {
+ return new WebInspector.NativeHeapSnapshotRetainerEdge(this._snapshot, this._retainedNodeIndex, this.retainerIndex());
+ },
+
+ isElement: function()
+ {
+ return this._edge().isElement();
+ },
+
+ isHidden: function()
+ {
+ return this._edge().isHidden();
+ },
+
+ isInternal: function()
+ {
+ return this._edge().isInternal();
+ },
+
+ isInvisible: function()
+ {
+ return this._edge().isInvisible();
+ },
+
+ isShortcut: function()
+ {
+ return this._edge().isShortcut();
+ },
+
+ isWeak: function()
+ {
+ return this._edge().isWeak();
+ },
+
+ __proto__: WebInspector.HeapSnapshotRetainerEdge.prototype
+}
+
Modified: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js (140389 => 140390)
--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js 2013-01-22 08:02:36 UTC (rev 140389)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js 2013-01-22 08:10:10 UTC (rev 140390)
@@ -233,22 +233,236 @@
}
+
+
/**
* @constructor
* @extends {WebInspector.ProfileType}
*/
+WebInspector.NativeSnapshotProfileType = function()
+{
+ WebInspector.ProfileType.call(this, WebInspector.NativeSnapshotProfileType.TypeId, WebInspector.UIString("Take Native Heap Snapshot"));
+ this._nextProfileUid = 1;
+}
+
+WebInspector.NativeSnapshotProfileType.TypeId = "NATIVE_SNAPSHOT";
+
+WebInspector.NativeSnapshotProfileType.prototype = {
+ get buttonTooltip()
+ {
+ return WebInspector.UIString("Capture native heap graph.");
+ },
+
+ /**
+ * @override
+ * @param {WebInspector.ProfilesPanel} profilesPanel
+ * @return {boolean}
+ */
+ buttonClicked: function(profilesPanel)
+ {
+ var profileHeader = new WebInspector.NativeSnapshotProfileHeader(this, WebInspector.UIString("Snapshot %d", this._nextProfileUid), this._nextProfileUid);
+ ++this._nextProfileUid;
+ profileHeader.isTemporary = true;
+ profilesPanel.addProfileHeader(profileHeader);
+ /**
+ * @param {?string} error
+ * @param {?MemoryAgent.MemoryBlock} memoryBlock
+ * @param {?Object=} graph
+ */
+ function didReceiveMemorySnapshot(error, memoryBlock, graph)
+ {
+ profileHeader._graph = new WebInspector.NativeHeapGraph(graph);
+ profileHeader.isTemporary = false;
+ profileHeader.sidebarElement.subtitle = Number.bytesToString(/** @type{number} */(memoryBlock.size));
+ }
+ MemoryAgent.getProcessMemoryDistribution(true, didReceiveMemorySnapshot.bind(this));
+ return false;
+ },
+
+ get treeItemTitle()
+ {
+ return WebInspector.UIString("NATIVE SNAPSHOT");
+ },
+
+ get description()
+ {
+ return WebInspector.UIString("Native memory snapshot profiles show native heap graph.");
+ },
+
+ /**
+ * @override
+ * @param {string=} title
+ * @return {WebInspector.ProfileHeader}
+ */
+ createTemporaryProfile: function(title)
+ {
+ title = title || WebInspector.UIString("Snapshotting\u2026");
+ return new WebInspector.NativeSnapshotProfileHeader(this, title);
+ },
+
+ /**
+ * @override
+ * @param {ProfilerAgent.ProfileHeader} profile
+ * @return {WebInspector.ProfileHeader}
+ */
+ createProfile: function(profile)
+ {
+ return new WebInspector.NativeSnapshotProfileHeader(this, profile.title, -1);
+ },
+
+ __proto__: WebInspector.ProfileType.prototype
+}
+
+
+/**
+ * @constructor
+ * @extends {WebInspector.HeapProfileHeader}
+ * @param {!WebInspector.NativeSnapshotProfileType} type
+ * @param {string} title
+ * @param {number=} uid
+ */
+WebInspector.NativeSnapshotProfileHeader = function(type, title, uid)
+{
+ WebInspector.HeapProfileHeader.call(this, type, title, uid, 0);
+}
+
+WebInspector.NativeSnapshotProfileHeader.prototype = {
+ /**
+ * @override
+ * @param {WebInspector.ProfilesPanel} profilesPanel
+ */
+ createView: function(profilesPanel)
+ {
+ return new WebInspector.NativeHeapSnapshotView(profilesPanel, this);
+ },
+
+ startSnapshotTransfer: function()
+ {
+ setTimeout(this._takeNativeSnapshot.bind(this), 0);
+ },
+
+ snapshotConstructorName: function()
+ {
+ return "NativeHeapSnapshot";
+ },
+
+ _takeNativeSnapshot: function()
+ {
+ /**
+ * @param {?string} error
+ * @param {?MemoryAgent.MemoryBlock} memoryBlock
+ * @param {?Object=} graph
+ */
+ function didReceiveMemorySnapshot(error, memoryBlock, graph)
+ {
+ var meta = {
+ "node_fields": [
+ "type",
+ "name",
+ "id",
+ "self_size",
+ "edge_count"
+ ],
+ "node_types": [
+ [
+ "hidden",
+ "array",
+ "string",
+ "object",
+ "code",
+ "closure",
+ "regexp",
+ "number",
+ "native",
+ "synthetic"
+ ],
+ "string",
+ "number",
+ "number",
+ "number",
+ "number",
+ "number"
+ ],
+ "edge_fields": [
+ "type",
+ "name_or_index",
+ "to_node"
+ ],
+ "edge_types": [
+ [
+ "context",
+ "element",
+ "property",
+ "internal",
+ "hidden",
+ "shortcut",
+ "weak"
+ ],
+ "string_or_number",
+ "node"
+ ]
+ };
+ var heapSnapshot = {
+ "snapshot": {
+ "meta": meta,
+ node_count: graph.nodes.length / 5,
+ edge_count: graph.edges.length / 3,
+ root_index: graph.nodes.length - 5
+ },
+ nodes: graph.nodes,
+ edges: graph.edges,
+ strings: graph.strings
+ };
+
+ var chunk = JSON.stringify(heapSnapshot);
+ this.transferChunk(chunk);
+ this.finishHeapSnapshot();
+ }
+ MemoryAgent.getProcessMemoryDistribution(true, didReceiveMemorySnapshot.bind(this));
+
+ },
+
+ __proto__: WebInspector.HeapProfileHeader.prototype
+}
+
+
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotView}
+ */
+WebInspector.NativeHeapSnapshotView = function(parent, profile)
+{
+ this._profile = profile;
+ WebInspector.HeapSnapshotView.call(this, parent, profile);
+}
+
+
+WebInspector.NativeHeapSnapshotView.prototype = {
+ get profile()
+ {
+ return this._profile;
+ },
+
+ __proto__: WebInspector.HeapSnapshotView.prototype
+};
+
+
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileType}
+ */
WebInspector.NativeMemoryProfileType = function()
{
- WebInspector.ProfileType.call(this, WebInspector.NativeMemoryProfileType.TypeId, WebInspector.UIString("Take Native Memory Snapshot"));
+ WebInspector.ProfileType.call(this, WebInspector.NativeMemoryProfileType.TypeId, WebInspector.UIString("Capture Native Memory Distribution"));
this._nextProfileUid = 1;
}
-WebInspector.NativeMemoryProfileType.TypeId = "NATIVE_MEMORY";
+WebInspector.NativeMemoryProfileType.TypeId = "NATIVE_MEMORY_DISTRIBUTION";
WebInspector.NativeMemoryProfileType.prototype = {
get buttonTooltip()
{
- return WebInspector.UIString("Take native memory snapshot.");
+ return WebInspector.UIString("Capture native memory distribution.");
},
/**
Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (140389 => 140390)
--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2013-01-22 08:02:36 UTC (rev 140389)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2013-01-22 08:10:10 UTC (rev 140390)
@@ -261,8 +261,10 @@
this._registerProfileType(new WebInspector.CSSSelectorProfileType());
if (Capabilities.heapProfilerPresent)
this._registerProfileType(new WebInspector.HeapSnapshotProfileType());
- if (WebInspector.experimentsSettings.nativeMemorySnapshots.isEnabled())
+ if (WebInspector.experimentsSettings.nativeMemorySnapshots.isEnabled()) {
this._registerProfileType(new WebInspector.NativeMemoryProfileType());
+ this._registerProfileType(new WebInspector.NativeSnapshotProfileType());
+ }
if (WebInspector.experimentsSettings.canvasInspection.isEnabled())
this._registerProfileType(new WebInspector.CanvasProfileType());
@@ -1382,6 +1384,7 @@
importScript("HeapSnapshotWorkerDispatcher.js");
importScript("JSHeapSnapshot.js");
importScript("NativeHeapGraph.js");
+importScript("NativeHeapSnapshot.js");
importScript("NativeMemorySnapshotView.js");
importScript("ProfileLauncherView.js");
importScript("TopDownProfileDataGridTree.js");
Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (140389 => 140390)
--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2013-01-22 08:02:36 UTC (rev 140389)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2013-01-22 08:10:10 UTC (rev 140390)
@@ -114,6 +114,7 @@
<file>MetricsSidebarPane.js</file>
<file>NativeBreakpointsSidebarPane.js</file>
<file>NativeHeapGraph.js</file>
+ <file>NativeHeapSnapshot.js</file>
<file>NativeMemorySnapshotView.js</file>
<file>NavigatorOverlayController.js</file>
<file>NavigatorView.js</file>