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

Side by Side Diff: chrome/browser/resources/tracking.js

Issue 8565037: Add the ability to click on source locations in about:profiler, and have it jump to the correspon... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: make sure long lines wrap 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var g_browserBridge; 5 var g_browserBridge;
6 var g_mainView; 6 var g_mainView;
7 7
8 // TODO(eroman): Don't repeat the work of grouping, sorting, merging on every 8 // TODO(eroman): Don't repeat the work of grouping, sorting, merging on every
9 // redraw. Rather do it only once when one of its dependencies 9 // redraw. Rather do it only once when one of its dependencies
10 // change and cache the result. 10 // change and cache the result.
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 */ 993 */
994 function drawValueToCell(td, key, value) { 994 function drawValueToCell(td, key, value) {
995 // Get a text representation of the value. 995 // Get a text representation of the value.
996 var text = getTextValueForProperty(key, value); 996 var text = getTextValueForProperty(key, value);
997 997
998 // Apply the desired cell alignment. 998 // Apply the desired cell alignment.
999 var cellAlignment = KEY_PROPERTIES[key].cellAlignment; 999 var cellAlignment = KEY_PROPERTIES[key].cellAlignment;
1000 if (cellAlignment) 1000 if (cellAlignment)
1001 td.align = cellAlignment; 1001 td.align = cellAlignment;
1002 1002
1003 var parent = td;
1004
1005 if (key == KEY_SOURCE_LOCATION) {
1006 // Linkify the source column so it jumps to the source code. This doesn't
1007 // take into account the particular code this build was compiled from, or
1008 // local edits to source. It should however work correctly for top of tree
1009 // builds.
1010 var m = /^(.*) \[(\d+)\]$/.exec(text);
1011 if (m) {
1012 var link = addNode(td, 'a');
1013 // http://chromesrc.appspot.com is a server I wrote specifically for
1014 // this task. It redirects to the appropriate source file; the file
1015 // paths given by the compiler can be pretty crazy and different
1016 // between platforms.
1017 link.href = 'http://chromesrc.appspot.com/?path=' +
1018 encodeURIComponent(m[1]) + '&line=' + m[2];
1019 parent = link;
1020 }
1021 }
1022
1003 // String values can get pretty long. If the string contains no spaces, then 1023 // String values can get pretty long. If the string contains no spaces, then
1004 // CSS fails to wrap it, and it overflows the cell causing the table to get 1024 // CSS fails to wrap it, and it overflows the cell causing the table to get
1005 // really big. We solve this using a hack: insert a <wbr> element after 1025 // really big. We solve this using a hack: insert a <wbr> element after
1006 // every single character. This will allow the rendering engine to wrap the 1026 // every single character. This will allow the rendering engine to wrap the
1007 // value, and hence avoid it overflowing! 1027 // value, and hence avoid it overflowing!
1008 var kMinLengthBeforeWrap = 20; 1028 var kMinLengthBeforeWrap = 20;
1009 1029
1010 addText(td, text.substr(0, kMinLengthBeforeWrap)); 1030 addText(parent, text.substr(0, kMinLengthBeforeWrap));
1011 for (var i = kMinLengthBeforeWrap; i < text.length; ++i) { 1031 for (var i = kMinLengthBeforeWrap; i < text.length; ++i) {
1012 addNode(td, 'wbr'); 1032 addNode(parent, 'wbr');
1013 addText(td, text.substr(i, 1)); 1033 addText(parent, text.substr(i, 1));
1014 } 1034 }
1015 } 1035 }
1016 1036
1017 function drawTableBody(tbody, rows, columns) { 1037 function drawTableBody(tbody, rows, columns) {
1018 for (var i = 0; i < rows.length; ++i) { 1038 for (var i = 0; i < rows.length; ++i) {
1019 var e = rows[i]; 1039 var e = rows[i];
1020 1040
1021 var tr = addNode(tbody, 'tr'); 1041 var tr = addNode(tbody, 'tr');
1022 1042
1023 for (var c = 0; c < columns.length; ++c) { 1043 for (var c = 0; c < columns.length; ++c) {
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 groupKey.push(entry); 1523 groupKey.push(entry);
1504 } 1524 }
1505 1525
1506 return JSON.stringify(groupKey); 1526 return JSON.stringify(groupKey);
1507 }; 1527 };
1508 }, 1528 },
1509 }; 1529 };
1510 1530
1511 return MainView; 1531 return MainView;
1512 })(); 1532 })();
OLDNEW
« 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