- Revision
- 89666
- Author
- mnaga...@chromium.org
- Date
- 2011-06-24 04:47:36 -0700 (Fri, 24 Jun 2011)
Log Message
2011-06-23 Mikhail Naganov <mnaga...@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: [Chromium] Shorten DOMWindow URLs in heap profiles.
https://bugs.webkit.org/show_bug.cgi?id=63238
* inspector/front-end/DetailedHeapshotGridNodes.js:
(WebInspector.HeapSnapshotGridNode.prototype.hasHoverMessage.false.hoverMessage):
(WebInspector.HeapSnapshotGenericObjectNode):
(WebInspector.HeapSnapshotGenericObjectNode.prototype.hoverMessage):
(WebInspector.HeapSnapshotGenericObjectNode.prototype._updateHasChildren):
(WebInspector.HeapSnapshotGenericObjectNode.prototype.isDOMWindow):
(WebInspector.HeapSnapshotGenericObjectNode.prototype.shortenWindowURL):
* inspector/front-end/DetailedHeapshotView.js:
(WebInspector.HeapSnapshotRetainingPathsList.prototype.showNext.pathFound):
(WebInspector.DetailedHeapshotView.prototype._getHoverAnchor):
(WebInspector.DetailedHeapshotView.prototype._showStringContentPopup.displayString):
(WebInspector.DetailedHeapshotView.prototype._showStringContentPopup):
* inspector/front-end/utilities.js:
():
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (89665 => 89666)
--- trunk/Source/WebCore/ChangeLog 2011-06-24 11:18:50 UTC (rev 89665)
+++ trunk/Source/WebCore/ChangeLog 2011-06-24 11:47:36 UTC (rev 89666)
@@ -1,3 +1,25 @@
+2011-06-23 Mikhail Naganov <mnaga...@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: [Chromium] Shorten DOMWindow URLs in heap profiles.
+ https://bugs.webkit.org/show_bug.cgi?id=63238
+
+ * inspector/front-end/DetailedHeapshotGridNodes.js:
+ (WebInspector.HeapSnapshotGridNode.prototype.hasHoverMessage.false.hoverMessage):
+ (WebInspector.HeapSnapshotGenericObjectNode):
+ (WebInspector.HeapSnapshotGenericObjectNode.prototype.hoverMessage):
+ (WebInspector.HeapSnapshotGenericObjectNode.prototype._updateHasChildren):
+ (WebInspector.HeapSnapshotGenericObjectNode.prototype.isDOMWindow):
+ (WebInspector.HeapSnapshotGenericObjectNode.prototype.shortenWindowURL):
+ * inspector/front-end/DetailedHeapshotView.js:
+ (WebInspector.HeapSnapshotRetainingPathsList.prototype.showNext.pathFound):
+ (WebInspector.DetailedHeapshotView.prototype._getHoverAnchor):
+ (WebInspector.DetailedHeapshotView.prototype._showStringContentPopup.displayString):
+ (WebInspector.DetailedHeapshotView.prototype._showStringContentPopup):
+ * inspector/front-end/utilities.js:
+ ():
+
2011-06-24 Vsevolod Vlasov <vse...@chromium.org>
Reviewed by Pavel Feldman.
Modified: trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js (89665 => 89666)
--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js 2011-06-24 11:18:50 UTC (rev 89665)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js 2011-06-24 11:47:36 UTC (rev 89666)
@@ -54,6 +54,13 @@
node.dispose();
},
+ hasHoverMessage: false,
+
+ hoverMessage: function(callback)
+ {
+ callback("");
+ },
+
_populate: function(event)
{
this.removeEventListener("populate", this._populate, this);
@@ -179,6 +186,14 @@
this._retainedSize = node.retainedSize;
this.snapshotNodeId = node.id;
this.snapshotNodeIndex = node.nodeIndex;
+ if (this._type === "string")
+ this.hasHoverMessage = true;
+ else if (this._type === "object" && this.isDOMWindow(this._name)) {
+ var url = ""
+ this._name = this.shortenWindowURL(this._name, false, url);
+ this._url = url[0];
+ this.hasHoverMessage = true;
+ }
};
WebInspector.HeapSnapshotGenericObjectNode.prototype = {
@@ -254,6 +269,14 @@
return this._enhanceData ? this._enhanceData(data) : data;
},
+ hoverMessage: function(callback)
+ {
+ if (this._type === "string")
+ callback("\"" + this._name + "\"", "console-formatted-string");
+ else if (this._url)
+ callback(this._url, "console-formatted-object");
+ },
+
get _retainedSizePercent()
{
return this._retainedSize / this.dataGrid.snapshot.totalSize * 100.0;
@@ -271,6 +294,27 @@
this.hasChildren = !isEmpty;
}
this._provider.isEmpty(isEmptyCallback.bind(this));
+ },
+
+ isDOMWindow: function(fullName)
+ {
+ return fullName.substr(0, 9) === "DOMWindow";
+ },
+
+ shortenWindowURL: function(fullName, hasObjectId, fullURLPtr)
+ {
+ var startPos = fullName.indexOf("/");
+ var endPos = hasObjectId ? fullName.indexOf("@") : fullName.length;
+ if (startPos !== -1 && endPos !== -1) {
+ var fullURL = fullName.substring(startPos + 1, endPos).trimLeft();
+ if (fullURLPtr)
+ fullURLPtr[0] = fullURL;
+ var url = ""
+ if (url.length > 40)
+ url = ""
+ return fullName.substr(0, startPos + 2) + url + fullName.substr(endPos);
+ } else
+ return fullName;
}
}
Modified: trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js (89665 => 89666)
--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js 2011-06-24 11:18:50 UTC (rev 89665)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js 2011-06-24 11:47:36 UTC (rev 89666)
@@ -420,6 +420,8 @@
this.appendChild(new WebInspector.DataGridNode({path:WebInspector.UIString("Can't find any paths."), len:""}, false));
return;
} else if (result !== false) {
+ if (WebInspector.HeapSnapshotGenericObjectNode.prototype.isDOMWindow(result.path))
+ result.path = WebInspector.HeapSnapshotGenericObjectNode.prototype.shortenWindowURL(result.path, true);
if (this._prefix)
result.path = this._prefix + result.path;
var node = new WebInspector.DataGridNode(result, false);
@@ -997,15 +999,15 @@
_getHoverAnchor: function(target)
{
var span = target.enclosingNodeOrSelfWithNodeName("span");
- if (!span || !span.hasStyleClass("console-formatted-string"))
+ if (!span)
return;
var row = target.enclosingNodeOrSelfWithNodeName("tr");
if (!row)
return;
var gridNode = row._dataGridNode;
- if (!gridNode.snapshotNodeIndex)
+ if (!gridNode.hasHoverMessage)
return;
- span.snapshotNodeIndex = gridNode.snapshotNodeIndex;
+ span.node = gridNode;
return span;
},
@@ -1031,18 +1033,17 @@
_showStringContentPopup: function(span)
{
var stringContentElement = document.createElement("span");
- stringContentElement.className = "monospace console-formatted-string";
+ stringContentElement.className = "monospace";
stringContentElement.style.whiteSpace = "pre";
var popover = new WebInspector.Popover(stringContentElement);
- function displayString(names)
+ function displayString(name, className)
{
- if (names.length > 0) {
- stringContentElement.textContent = "\"" + names[0] + "\"";
- popover.show(span);
- }
+ stringContentElement.textContent = name;
+ stringContentElement.className += " " + className;
+ popover.show(span);
}
- this.profileWrapper.nodeFieldValuesByIndex("name", [span.snapshotNodeIndex], displayString);
+ span.node.hoverMessage(displayString);
return popover;
},
Modified: trunk/Source/WebCore/inspector/front-end/utilities.js (89665 => 89666)
--- trunk/Source/WebCore/inspector/front-end/utilities.js 2011-06-24 11:18:50 UTC (rev 89665)
+++ trunk/Source/WebCore/inspector/front-end/utilities.js 2011-06-24 11:47:36 UTC (rev 89666)
@@ -451,6 +451,15 @@
return this.replace(/[\s\xA0]+/g, " ");
}
+String.prototype.trimMiddle = function(maxLength)
+{
+ if (this.length <= maxLength)
+ return this;
+ var leftHalf = maxLength >> 1;
+ var rightHalf = maxLength - leftHalf - 1;
+ return this.substr(0, leftHalf) + "\u2026" + this.substr(this.length - rightHalf, rightHalf);
+}
+
String.prototype.trimURL = function(baseURLDomain)
{
var result = this.replace(/^(https|http|file):\/\//i, "");