Modified: branches/chromium/782/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js (90018 => 90019)
--- branches/chromium/782/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js 2011-06-29 15:17:24 UTC (rev 90018)
+++ branches/chromium/782/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js 2011-06-29 15:20:22 UTC (rev 90019)
@@ -54,6 +54,13 @@
node.dispose();
},
+ hasHoverMessage: false,
+
+ hoverMessage: function(callback)
+ {
+ callback("");
+ },
+
_populate: function(event)
{
this.removeEventListener("populate", this._populate, this);
@@ -172,6 +179,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 = {
@@ -247,6 +262,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;
@@ -264,6 +287,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: branches/chromium/782/Source/WebCore/inspector/front-end/DetailedHeapshotView.js (90018 => 90019)
--- branches/chromium/782/Source/WebCore/inspector/front-end/DetailedHeapshotView.js 2011-06-29 15:17:24 UTC (rev 90018)
+++ branches/chromium/782/Source/WebCore/inspector/front-end/DetailedHeapshotView.js 2011-06-29 15:20:22 UTC (rev 90019)
@@ -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: branches/chromium/782/Source/WebCore/inspector/front-end/utilities.js (90018 => 90019)
--- branches/chromium/782/Source/WebCore/inspector/front-end/utilities.js 2011-06-29 15:17:24 UTC (rev 90018)
+++ branches/chromium/782/Source/WebCore/inspector/front-end/utilities.js 2011-06-29 15:20:22 UTC (rev 90019)
@@ -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, "");