Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3142)

Unified Diff: chrome/browser/resources/tracking.js

Issue 8555028: Change the "source location" column on about:profiler to only display the filename (rather than t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/tracking.js
===================================================================
--- chrome/browser/resources/tracking.js (revision 110011)
+++ chrome/browser/resources/tracking.js (working copy)
@@ -703,6 +703,19 @@
return false;
}
+ /**
+ * Return the last component in a path which is separated by either forward
+ * slashes or backslashes.
+ */
+ function getFilenameFromPath(path) {
+ var lastSlash = Math.max(path.lastIndexOf('/'),
+ path.lastIndexOf('\\'));
+ if (lastSlash == -1)
+ return path;
+
+ return path.substr(lastSlash + 1);
+ }
+
// --------------------------------------------------------------------------
// Functions that augment, bucket, and compute aggregates for the input data.
// --------------------------------------------------------------------------
@@ -1000,8 +1013,6 @@
if (cellAlignment)
td.align = cellAlignment;
- var parent = td;
-
if (key == KEY_SOURCE_LOCATION) {
// Linkify the source column so it jumps to the source code. This doesn't
// take into account the particular code this build was compiled from, or
@@ -1009,14 +1020,18 @@
// builds.
var m = /^(.*) \[(\d+)\]$/.exec(text);
if (m) {
- var link = addNode(td, 'a');
+ var filepath = m[1];
+ var filename = getFilenameFromPath(filepath);
+ var linenumber = m[2];
+
+ var link = addNode(td, 'a', filename + ' [' + linenumber + ']');
// http://chromesrc.appspot.com is a server I wrote specifically for
// this task. It redirects to the appropriate source file; the file
// paths given by the compiler can be pretty crazy and different
// between platforms.
link.href = 'http://chromesrc.appspot.com/?path=' +
- encodeURIComponent(m[1]) + '&line=' + m[2];
- parent = link;
+ encodeURIComponent(filepath) + '&line=' + linenumber;
+ return;
}
}
@@ -1027,10 +1042,10 @@
// value, and hence avoid it overflowing!
var kMinLengthBeforeWrap = 20;
- addText(parent, text.substr(0, kMinLengthBeforeWrap));
+ addText(td, text.substr(0, kMinLengthBeforeWrap));
for (var i = kMinLengthBeforeWrap; i < text.length; ++i) {
- addNode(parent, 'wbr');
- addText(parent, text.substr(i, 1));
+ addNode(td, 'wbr');
+ addText(td, text.substr(i, 1));
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698