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

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

Issue 2156523003: [DevTools] Fix links for JSFrame records in timeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 case recordType.XHRReadyStateChange: 558 case recordType.XHRReadyStateChange:
559 case recordType.XHRLoad: 559 case recordType.XHRLoad:
560 case recordType.ResourceSendRequest: 560 case recordType.ResourceSendRequest:
561 case recordType.ResourceReceivedData: 561 case recordType.ResourceReceivedData:
562 case recordType.ResourceReceiveResponse: 562 case recordType.ResourceReceiveResponse:
563 case recordType.ResourceFinish: 563 case recordType.ResourceFinish:
564 if (event.url) 564 if (event.url)
565 details = WebInspector.linkifyResourceAsNode(event.url); 565 details = WebInspector.linkifyResourceAsNode(event.url);
566 break; 566 break;
567 case recordType.FunctionCall: 567 case recordType.FunctionCall:
568 details = linkifyLocation(eventData["scriptId"], eventData["scriptName"] , eventData["scriptLine"], 0); 568 details = linkifyLocation(eventData["scriptId"], eventData["scriptName"] , eventData["scriptLine"] - 1, 0);
569 break; 569 break;
570 case recordType.JSFrame: 570 case recordType.JSFrame:
571 details = createElement("span"); 571 details = createElement("span");
572 details.createTextChild(WebInspector.beautifyFunctionName(eventData["fun ctionName"])); 572 details.createTextChild(WebInspector.beautifyFunctionName(eventData["fun ctionName"]));
573 var location = linkifyLocation(eventData["scriptId"], eventData["url"], eventData["lineNumber"], eventData["columnNumber"]); 573 var location = linkifyLocation(eventData["scriptId"], eventData["url"], eventData["lineNumber"], eventData["columnNumber"]);
574 if (location) { 574 if (location) {
575 details.createTextChild(" @ "); 575 details.createTextChild(" @ ");
576 details.appendChild(location); 576 details.appendChild(location);
577 } 577 }
578 break; 578 break;
579 case recordType.CompileScript: 579 case recordType.CompileScript:
580 case recordType.EvaluateScript: 580 case recordType.EvaluateScript:
581 var url = eventData["url"]; 581 var url = eventData["url"];
582 if (url) 582 if (url)
583 details = linkifyLocation("", url, eventData["lineNumber"], 0); 583 details = linkifyLocation("", url, eventData["lineNumber"] - 1, 0);
584 break; 584 break;
585 case recordType.ParseScriptOnBackground: 585 case recordType.ParseScriptOnBackground:
586 var url = eventData["url"]; 586 var url = eventData["url"];
587 if (url) 587 if (url)
588 details = linkifyLocation("", url, 0, 0); 588 details = linkifyLocation("", url, 0, 0);
589 break; 589 break;
590 default: 590 default:
591 if (event.hasCategory(WebInspector.TimelineModel.Category.Console)) 591 if (event.hasCategory(WebInspector.TimelineModel.Category.Console))
592 detailsText = null; 592 detailsText = null;
593 else 593 else
594 details = linkifyTopCallFrame(); 594 details = linkifyTopCallFrame();
595 break; 595 break;
596 } 596 }
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 */ 607 */
608 function linkifyLocation(scriptId, url, lineNumber, columnNumber) 608 function linkifyLocation(scriptId, url, lineNumber, columnNumber)
609 { 609 {
610 // FIXME(62725): stack trace line/column numbers are one-based. 610 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber , columnNumber, "timeline-details");
611 if (columnNumber)
612 --columnNumber;
613 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details");
614 } 611 }
615 612
616 /** 613 /**
617 * @return {?Element} 614 * @return {?Element}
618 */ 615 */
619 function linkifyTopCallFrame() 616 function linkifyTopCallFrame()
620 { 617 {
621 var frame = WebInspector.TimelineUIUtils.topStackFrame(event); 618 var frame = WebInspector.TimelineUIUtils.topStackFrame(event);
622 return frame ? linkifier.linkifyConsoleCallFrameForTimeline(target, fram e, "timeline-details") : null; 619 return frame ? linkifier.linkifyConsoleCallFrameForTracing(target, frame , "timeline-details") : null;
alph 2016/07/16 01:33:36 I think this can be a "tracing" frame as well as a
kozy 2016/07/16 04:54:04 I think that all frames from profiler have JSFrame
623 } 620 }
624 } 621 }
625 622
626 /** 623 /**
627 * @param {!WebInspector.TracingModel.Event} event 624 * @param {!WebInspector.TracingModel.Event} event
628 * @param {!WebInspector.TimelineModel} model 625 * @param {!WebInspector.TimelineModel} model
629 * @param {!WebInspector.Linkifier} linkifier 626 * @param {!WebInspector.Linkifier} linkifier
630 * @param {boolean} detailed 627 * @param {boolean} detailed
631 * @param {function(!DocumentFragment)} callback 628 * @param {function(!DocumentFragment)} callback
632 */ 629 */
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 var priority = WebInspector.uiLabelForPriority(/** @type {!NetworkAgent. ResourcePriority} */ (request.priority)); 986 var priority = WebInspector.uiLabelForPriority(/** @type {!NetworkAgent. ResourcePriority} */ (request.priority));
990 contentHelper.appendTextRow(WebInspector.UIString("Priority"), priority) ; 987 contentHelper.appendTextRow(WebInspector.UIString("Priority"), priority) ;
991 } 988 }
992 if (request.mimeType) 989 if (request.mimeType)
993 contentHelper.appendTextRow(WebInspector.UIString("Mime Type"), request. mimeType); 990 contentHelper.appendTextRow(WebInspector.UIString("Mime Type"), request. mimeType);
994 991
995 var title = WebInspector.UIString("Initiator"); 992 var title = WebInspector.UIString("Initiator");
996 var sendRequest = request.children[0]; 993 var sendRequest = request.children[0];
997 var topFrame = WebInspector.TimelineUIUtils.topStackFrame(sendRequest); 994 var topFrame = WebInspector.TimelineUIUtils.topStackFrame(sendRequest);
998 if (topFrame) { 995 if (topFrame) {
999 contentHelper.appendElementRow(title, linkifier.linkifyConsoleCallFrameF orTimeline(target, topFrame)); 996 contentHelper.appendElementRow(title, linkifier.linkifyConsoleCallFrameF orTracing(target, topFrame));
1000 } else if (sendRequest.initiator) { 997 } else if (sendRequest.initiator) {
1001 var initiatorURL = WebInspector.TimelineUIUtils.eventURL(sendRequest.ini tiator); 998 var initiatorURL = WebInspector.TimelineUIUtils.eventURL(sendRequest.ini tiator);
1002 if (initiatorURL) 999 if (initiatorURL)
1003 contentHelper.appendElementRow(title, linkifier.linkifyScriptLocatio n(target, null, initiatorURL, 0)); 1000 contentHelper.appendElementRow(title, linkifier.linkifyScriptLocatio n(target, null, initiatorURL, 0));
1004 } 1001 }
1005 1002
1006 /** 1003 /**
1007 * @param {function(?Element)} fulfill 1004 * @param {function(?Element)} fulfill
1008 */ 1005 */
1009 function action(fulfill) 1006 function action(fulfill)
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 else 1231 else
1235 title.createTextChild(WebInspector.UIString("Unknown cause for ")); 1232 title.createTextChild(WebInspector.UIString("Unknown cause for "));
1236 1233
1237 this._appendTruncatedNodeList(title, this._invalidations); 1234 this._appendTruncatedNodeList(title, this._invalidations);
1238 1235
1239 if (topFrame && this._contentHelper.linkifier()) { 1236 if (topFrame && this._contentHelper.linkifier()) {
1240 title.createTextChild(WebInspector.UIString(". ")); 1237 title.createTextChild(WebInspector.UIString(". "));
1241 var stack = title.createChild("span", "monospace"); 1238 var stack = title.createChild("span", "monospace");
1242 stack.createChild("span").textContent = WebInspector.beautifyFunctio nName(topFrame.functionName); 1239 stack.createChild("span").textContent = WebInspector.beautifyFunctio nName(topFrame.functionName);
1243 stack.createChild("span").textContent = " @ "; 1240 stack.createChild("span").textContent = " @ ";
1244 stack.createChild("span").appendChild(this._contentHelper.linkifier( ).linkifyConsoleCallFrameForTimeline(target, topFrame)); 1241 stack.createChild("span").appendChild(this._contentHelper.linkifier( ).linkifyConsoleCallFrameForTracing(target, topFrame));
1245 } 1242 }
1246 1243
1247 return title; 1244 return title;
1248 }, 1245 },
1249 1246
1250 /** 1247 /**
1251 * @override 1248 * @override
1252 */ 1249 */
1253 onpopulate: function() 1250 onpopulate: function()
1254 { 1251 {
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 case warnings.V8Deopt: 2135 case warnings.V8Deopt:
2139 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", 2136 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53",
2140 WebInspector.UIString("Not optimized"), undefined, true)); 2137 WebInspector.UIString("Not optimized"), undefined, true));
2141 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); 2138 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"]));
2142 break; 2139 break;
2143 default: 2140 default:
2144 console.assert(false, "Unhandled TimelineModel.WarningType"); 2141 console.assert(false, "Unhandled TimelineModel.WarningType");
2145 } 2142 }
2146 return span; 2143 return span;
2147 } 2144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698