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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js

Issue 2151653005: DevTools: Do not linkify to pseudo (program) node when there's no URL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments Created 4 years, 5 months 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js ('k') | 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 523
524 /** 524 /**
525 * @param {!WebInspector.TracingModel.Event} event 525 * @param {!WebInspector.TracingModel.Event} event
526 * @param {?WebInspector.Target} target 526 * @param {?WebInspector.Target} target
527 * @param {!WebInspector.Linkifier} linkifier 527 * @param {!WebInspector.Linkifier} linkifier
528 * @return {?Node} 528 * @return {?Node}
529 */ 529 */
530 WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar get, linkifier) 530 WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar get, linkifier)
531 { 531 {
532 var recordType = WebInspector.TimelineModel.RecordType; 532 var recordType = WebInspector.TimelineModel.RecordType;
533 var details; 533 var details = null;
534 var detailsText; 534 var detailsText;
535 var eventData = event.args["data"]; 535 var eventData = event.args["data"];
536 switch (event.name) { 536 switch (event.name) {
537 case recordType.GCEvent: 537 case recordType.GCEvent:
538 case recordType.MajorGC: 538 case recordType.MajorGC:
539 case recordType.MinorGC: 539 case recordType.MinorGC:
540 case recordType.EventDispatch: 540 case recordType.EventDispatch:
541 case recordType.Paint: 541 case recordType.Paint:
542 case recordType.Animation: 542 case recordType.Animation:
543 case recordType.EmbedderCallback: 543 case recordType.EmbedderCallback:
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 if (!details && detailsText) 598 if (!details && detailsText)
599 details = createTextNode(detailsText); 599 details = createTextNode(detailsText);
600 return details; 600 return details;
601 601
602 /** 602 /**
603 * @param {string} scriptId 603 * @param {string} scriptId
604 * @param {string} url 604 * @param {string} url
605 * @param {number} lineNumber 605 * @param {number} lineNumber
606 * @param {number=} columnNumber 606 * @param {number=} columnNumber
607 * @return {?Element}
607 */ 608 */
608 function linkifyLocation(scriptId, url, lineNumber, columnNumber) 609 function linkifyLocation(scriptId, url, lineNumber, columnNumber)
609 { 610 {
610 // FIXME(62725): stack trace line/column numbers are one-based. 611 // FIXME(62725): stack trace line/column numbers are one-based.
611 if (columnNumber) 612 if (columnNumber)
612 --columnNumber; 613 --columnNumber;
613 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details"); 614 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details");
614 } 615 }
615 616
616 /** 617 /**
617 * @return {?Element} 618 * @return {?Element}
618 */ 619 */
619 function linkifyTopCallFrame() 620 function linkifyTopCallFrame()
620 { 621 {
621 var frame = WebInspector.TimelineUIUtils.topStackFrame(event); 622 var frame = WebInspector.TimelineUIUtils.topStackFrame(event);
622 return frame ? linkifier.linkifyConsoleCallFrameForTimeline(target, fram e, "timeline-details") : null; 623 return frame ? linkifier.maybeLinkifyConsoleCallFrameForTimeline(target, frame, "timeline-details") : null;
623 } 624 }
624 } 625 }
625 626
626 /** 627 /**
627 * @param {!WebInspector.TracingModel.Event} event 628 * @param {!WebInspector.TracingModel.Event} event
628 * @param {!WebInspector.TimelineModel} model 629 * @param {!WebInspector.TimelineModel} model
629 * @param {!WebInspector.Linkifier} linkifier 630 * @param {!WebInspector.Linkifier} linkifier
630 * @param {boolean} detailed 631 * @param {boolean} detailed
631 * @param {function(!DocumentFragment)} callback 632 * @param {function(!DocumentFragment)} callback
632 */ 633 */
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 var priority = WebInspector.uiLabelForPriority(/** @type {!NetworkAgent. ResourcePriority} */ (request.priority)); 990 var priority = WebInspector.uiLabelForPriority(/** @type {!NetworkAgent. ResourcePriority} */ (request.priority));
990 contentHelper.appendTextRow(WebInspector.UIString("Priority"), priority) ; 991 contentHelper.appendTextRow(WebInspector.UIString("Priority"), priority) ;
991 } 992 }
992 if (request.mimeType) 993 if (request.mimeType)
993 contentHelper.appendTextRow(WebInspector.UIString("Mime Type"), request. mimeType); 994 contentHelper.appendTextRow(WebInspector.UIString("Mime Type"), request. mimeType);
994 995
995 var title = WebInspector.UIString("Initiator"); 996 var title = WebInspector.UIString("Initiator");
996 var sendRequest = request.children[0]; 997 var sendRequest = request.children[0];
997 var topFrame = WebInspector.TimelineUIUtils.topStackFrame(sendRequest); 998 var topFrame = WebInspector.TimelineUIUtils.topStackFrame(sendRequest);
998 if (topFrame) { 999 if (topFrame) {
999 contentHelper.appendElementRow(title, linkifier.linkifyConsoleCallFrameF orTimeline(target, topFrame)); 1000 var link = linkifier.maybeLinkifyConsoleCallFrameForTimeline(target, top Frame);
1001 if (link)
1002 contentHelper.appendElementRow(title, link);
1000 } else if (sendRequest.initiator) { 1003 } else if (sendRequest.initiator) {
1001 var initiatorURL = WebInspector.TimelineUIUtils.eventURL(sendRequest.ini tiator); 1004 var initiatorURL = WebInspector.TimelineUIUtils.eventURL(sendRequest.ini tiator);
1002 if (initiatorURL) 1005 if (initiatorURL) {
1003 contentHelper.appendElementRow(title, linkifier.linkifyScriptLocatio n(target, null, initiatorURL, 0)); 1006 var link = linkifier.maybeLinkifyScriptLocation(target, null, initia torURL, 0);
1007 if (link)
1008 contentHelper.appendElementRow(title, link);
1009 }
1004 } 1010 }
1005 1011
1006 /** 1012 /**
1007 * @param {function(?Element)} fulfill 1013 * @param {function(?Element)} fulfill
1008 */ 1014 */
1009 function action(fulfill) 1015 function action(fulfill)
1010 { 1016 {
1011 WebInspector.DOMPresentationUtils.buildImagePreviewContents(/** @type {! WebInspector.Target} */(target), request.url, false, saveImage); 1017 WebInspector.DOMPresentationUtils.buildImagePreviewContents(/** @type {! WebInspector.Target} */(target), request.url, false, saveImage);
1012 /** 1018 /**
1013 * @param {!Element=} element 1019 * @param {!Element=} element
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 title.createTextChild(WebInspector.UIString("%s for ", reason)); 1239 title.createTextChild(WebInspector.UIString("%s for ", reason));
1234 else 1240 else
1235 title.createTextChild(WebInspector.UIString("Unknown cause for ")); 1241 title.createTextChild(WebInspector.UIString("Unknown cause for "));
1236 1242
1237 this._appendTruncatedNodeList(title, this._invalidations); 1243 this._appendTruncatedNodeList(title, this._invalidations);
1238 1244
1239 if (topFrame && this._contentHelper.linkifier()) { 1245 if (topFrame && this._contentHelper.linkifier()) {
1240 title.createTextChild(WebInspector.UIString(". ")); 1246 title.createTextChild(WebInspector.UIString(". "));
1241 var stack = title.createChild("span", "monospace"); 1247 var stack = title.createChild("span", "monospace");
1242 stack.createChild("span").textContent = WebInspector.beautifyFunctio nName(topFrame.functionName); 1248 stack.createChild("span").textContent = WebInspector.beautifyFunctio nName(topFrame.functionName);
1243 stack.createChild("span").textContent = " @ "; 1249 var link = this._contentHelper.linkifier().maybeLinkifyConsoleCallFr ameForTimeline(target, topFrame);
1244 stack.createChild("span").appendChild(this._contentHelper.linkifier( ).linkifyConsoleCallFrameForTimeline(target, topFrame)); 1250 if (link) {
1251 stack.createChild("span").textContent = " @ ";
1252 stack.createChild("span").appendChild(link);
1253 }
1245 } 1254 }
1246 1255
1247 return title; 1256 return title;
1248 }, 1257 },
1249 1258
1250 /** 1259 /**
1251 * @override 1260 * @override
1252 */ 1261 */
1253 onpopulate: function() 1262 onpopulate: function()
1254 { 1263 {
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 * @param {string} url 2053 * @param {string} url
2045 * @param {number} startLine 2054 * @param {number} startLine
2046 * @param {number=} startColumn 2055 * @param {number=} startColumn
2047 */ 2056 */
2048 appendLocationRow: function(title, url, startLine, startColumn) 2057 appendLocationRow: function(title, url, startLine, startColumn)
2049 { 2058 {
2050 if (!this._linkifier || !this._target) 2059 if (!this._linkifier || !this._target)
2051 return; 2060 return;
2052 if (startColumn) 2061 if (startColumn)
2053 --startColumn; 2062 --startColumn;
2054 this.appendElementRow(title, this._linkifier.linkifyScriptLocation(this. _target, null, url, startLine - 1, startColumn)); 2063 var link = this._linkifier.maybeLinkifyScriptLocation(this._target, null , url, startLine - 1, startColumn);
2064 if (!link)
2065 return;
2066 this.appendElementRow(title, link);
2055 }, 2067 },
2056 2068
2057 /** 2069 /**
2058 * @param {string} title 2070 * @param {string} title
2059 * @param {string} url 2071 * @param {string} url
2060 * @param {number} startLine 2072 * @param {number} startLine
2061 * @param {number=} endLine 2073 * @param {number=} endLine
2062 */ 2074 */
2063 appendLocationRange: function(title, url, startLine, endLine) 2075 appendLocationRange: function(title, url, startLine, endLine)
2064 { 2076 {
2065 if (!this._linkifier || !this._target) 2077 if (!this._linkifier || !this._target)
2066 return; 2078 return;
2067 var locationContent = createElement("span"); 2079 var locationContent = createElement("span");
2068 locationContent.appendChild(this._linkifier.linkifyScriptLocation(this._ target, null, url, startLine - 1)); 2080 var link = this._linkifier.maybeLinkifyScriptLocation(this._target, null , url, startLine - 1);
2081 if (!link)
2082 return;
2083 locationContent.appendChild(link);
2069 locationContent.createTextChild(String.sprintf(" [%s\u2026%s]", startLin e, endLine || "")); 2084 locationContent.createTextChild(String.sprintf(" [%s\u2026%s]", startLin e, endLine || ""));
2070 this.appendElementRow(title, locationContent); 2085 this.appendElementRow(title, locationContent);
2071 }, 2086 },
2072 2087
2073 /** 2088 /**
2074 * @param {string} title 2089 * @param {string} title
2075 * @param {!RuntimeAgent.StackTrace} stackTrace 2090 * @param {!RuntimeAgent.StackTrace} stackTrace
2076 */ 2091 */
2077 appendStackTrace: function(title, stackTrace) 2092 appendStackTrace: function(title, stackTrace)
2078 { 2093 {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 case warnings.V8Deopt: 2153 case warnings.V8Deopt:
2139 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", 2154 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53",
2140 WebInspector.UIString("Not optimized"), undefined, true)); 2155 WebInspector.UIString("Not optimized"), undefined, true));
2141 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); 2156 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"]));
2142 break; 2157 break;
2143 default: 2158 default:
2144 console.assert(false, "Unhandled TimelineModel.WarningType"); 2159 console.assert(false, "Unhandled TimelineModel.WarningType");
2145 } 2160 }
2146 return span; 2161 return span;
2147 } 2162 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698