Title: [100457] trunk/Tools
Revision
100457
Author
aro...@apple.com
Date
2011-11-16 08:50:18 -0800 (Wed, 16 Nov 2011)

Log Message

Move filenames/line numbers off to the right edge in Leaks Viewer

Fixes <http://webkit.org/b/72510> Callstacks in Leaks Viewer are a little hard to read
because filenames/line numbers are right next to function names

Reviewed by Andreas Kling.

* BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParserImpl.js:
(LeaksParserImpl.prototype._createNode): Separate the filename and line number out from the
function name. Use the filename as the profile node's URL (we don't have enough info to
compute a real URL currently) and the line number as the profile node's line number so the
Inspector code will put them on the right side of the callstack graph.

* BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js:
(WebInspector.displayNameForURL): Stubbed this out. For now we don't ever get any URLs
passed here, just filenames.

(WebInspector.linkifyURLAsNode):
(WebInspector.linkifyResourceAsNode):
Copied and slightly modified from inspector.js.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParserImpl.js (100456 => 100457)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParserImpl.js	2011-11-16 16:50:07 UTC (rev 100456)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParserImpl.js	2011-11-16 16:50:18 UTC (rev 100457)
@@ -54,6 +54,18 @@
     },
 
     _createNode: function(functionName) {
+        var url;
+        var lineNumber;
+        var match = /(.*) (\S+):(\d+)$/.exec(functionName);
+        if (match) {
+            functionName = match[1];
+            // FIXME: It would be nice to be able to link straight to the right line in Trac, but to
+            // do that we'd have to have some way of translating from filenames to Trac URLs.
+            // <http://webkit.org/b/72509>
+            url = ""
+            lineNumber = match[3];
+        }
+
         return {
             functionName: functionName,
             selfTime: 0,
@@ -63,6 +75,8 @@
             children: [],
             childrenByName: {},
             callUID: functionName,
+            url: url,
+            lineNumber: lineNumber,
         };
     },
 

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js (100456 => 100457)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js	2011-11-16 16:50:07 UTC (rev 100456)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js	2011-11-16 16:50:18 UTC (rev 100457)
@@ -27,6 +27,36 @@
 // import.
 
 var WebInspector = {
+    displayNameForURL: function(url) {
+        return url;
+    },
+
+    linkifyURLAsNode: function(url, linkText, classes, tooltipText) {
+        if (!linkText)
+            linkText = url;
+        classes = (classes ? classes + " " : "");
+
+        // FIXME: Create an <a> element here once we actually have somewhere useful to link to.
+        // <http://webkit.org/b/72509>
+        var a = document.createElement("span");
+        a.href = ""
+        a.className = classes;
+        if (typeof tooltipText === "undefined")
+            a.title = url;
+        else if (typeof tooltipText !== "string" || tooltipText.length)
+            a.title = tooltipText;
+        a.textContent = linkText;
+
+        return a;
+    },
+
+    linkifyResourceAsNode: function(url, preferredPanel, lineNumber, classes, tooltipText) {
+        var linkText = WebInspector.displayNameForURL(url);
+        if (lineNumber)
+            linkText += ":" + lineNumber;
+        return WebInspector.linkifyURLAsNode(url, linkText, classes, tooltipText);
+    },
+
     UIString: function(string) {
         return String.vsprintf(string, Array.prototype.slice.call(arguments, 1));
     },

Modified: trunk/Tools/ChangeLog (100456 => 100457)


--- trunk/Tools/ChangeLog	2011-11-16 16:50:07 UTC (rev 100456)
+++ trunk/Tools/ChangeLog	2011-11-16 16:50:18 UTC (rev 100457)
@@ -1,5 +1,28 @@
 2011-11-16  Adam Roben  <aro...@apple.com>
 
+        Move filenames/line numbers off to the right edge in Leaks Viewer
+
+        Fixes <http://webkit.org/b/72510> Callstacks in Leaks Viewer are a little hard to read
+        because filenames/line numbers are right next to function names
+
+        Reviewed by Andreas Kling.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParserImpl.js:
+        (LeaksParserImpl.prototype._createNode): Separate the filename and line number out from the
+        function name. Use the filename as the profile node's URL (we don't have enough info to
+        compute a real URL currently) and the line number as the profile node's line number so the
+        Inspector code will put them on the right side of the callstack graph.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js:
+        (WebInspector.displayNameForURL): Stubbed this out. For now we don't ever get any URLs
+        passed here, just filenames.
+
+        (WebInspector.linkifyURLAsNode):
+        (WebInspector.linkifyResourceAsNode):
+        Copied and slightly modified from inspector.js.
+
+2011-11-16  Adam Roben  <aro...@apple.com>
+
         Make Leaks Viewer load builds from the new Lion Leaks bot
 
         Fixes <http://webkit.org/b/72507> REGRESSION: Leaks Viewer no longer shows recent leaky builds
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to