OLD | NEW |
---|---|
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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
682 switch (record.type) { | 682 switch (record.type) { |
683 case WebInspector.TimelineModel.RecordType.GCEvent: | 683 case WebInspector.TimelineModel.RecordType.GCEvent: |
684 detailsText = WebInspector.UIString("%s collected", Number.bytesToString (record.data["usedHeapSizeDelta"])); | 684 detailsText = WebInspector.UIString("%s collected", Number.bytesToString (record.data["usedHeapSizeDelta"])); |
685 break; | 685 break; |
686 case WebInspector.TimelineModel.RecordType.TimerFire: | 686 case WebInspector.TimelineModel.RecordType.TimerFire: |
687 detailsText = record.data["timerId"]; | 687 detailsText = record.data["timerId"]; |
688 break; | 688 break; |
689 case WebInspector.TimelineModel.RecordType.FunctionCall: | 689 case WebInspector.TimelineModel.RecordType.FunctionCall: |
690 if (record.scriptName) | 690 if (record.scriptName) |
691 details = linkifyLocation(record.scriptName, record.scriptLine, 0); | 691 details = linkifyLocation(record.scriptName, record.scriptLine, 0); |
692 else if (record.scriptId) | |
693 details = linkifyRawLocation(record.scriptId, record.scriptLine, 0); | |
692 break; | 694 break; |
693 case WebInspector.TimelineModel.RecordType.FireAnimationFrame: | 695 case WebInspector.TimelineModel.RecordType.FireAnimationFrame: |
694 detailsText = record.data["id"]; | 696 detailsText = record.data["id"]; |
695 break; | 697 break; |
696 case WebInspector.TimelineModel.RecordType.EventDispatch: | 698 case WebInspector.TimelineModel.RecordType.EventDispatch: |
697 detailsText = record.data ? record.data["type"] : null; | 699 detailsText = record.data ? record.data["type"] : null; |
698 break; | 700 break; |
699 case WebInspector.TimelineModel.RecordType.Paint: | 701 case WebInspector.TimelineModel.RecordType.Paint: |
700 var width = record.data.clip ? WebInspector.TimelineUIUtils._quadWidth(r ecord.data.clip) : record.data.width; | 702 var width = record.data.clip ? WebInspector.TimelineUIUtils._quadWidth(r ecord.data.clip) : record.data.width; |
701 var height = record.data.clip ? WebInspector.TimelineUIUtils._quadHeight (record.data.clip) : record.data.height; | 703 var height = record.data.clip ? WebInspector.TimelineUIUtils._quadHeight (record.data.clip) : record.data.height; |
(...skipping 28 matching lines...) Expand all Loading... | |
730 case WebInspector.TimelineModel.RecordType.ResizeImage: | 732 case WebInspector.TimelineModel.RecordType.ResizeImage: |
731 detailsText = WebInspector.displayNameForURL(record.url); | 733 detailsText = WebInspector.displayNameForURL(record.url); |
732 break; | 734 break; |
733 case WebInspector.TimelineModel.RecordType.ConsoleTime: | 735 case WebInspector.TimelineModel.RecordType.ConsoleTime: |
734 detailsText = record.data["message"]; | 736 detailsText = record.data["message"]; |
735 break; | 737 break; |
736 case WebInspector.TimelineModel.RecordType.EmbedderCallback: | 738 case WebInspector.TimelineModel.RecordType.EmbedderCallback: |
737 detailsText = record.data["callbackName"]; | 739 detailsText = record.data["callbackName"]; |
738 break; | 740 break; |
739 default: | 741 default: |
740 details = record.scriptName ? linkifyLocation(record.scriptName, record. scriptLine, 0) : linkifyTopCallFrame(); | 742 if (record.scriptName) |
pfeldman
2014/03/28 15:17:07
1) Why is this default?
2) Generic record does not
| |
743 details = linkifyLocation(record.scriptName, record.scriptLine, 0); | |
744 else if (record.scriptId) | |
745 details = linkifyRawLocation(record.scriptId, record.scriptLine, 0); | |
746 else | |
747 details = linkifyTopCallFrame(); | |
741 break; | 748 break; |
742 } | 749 } |
743 | 750 |
744 if (!details && detailsText) | 751 if (!details && detailsText) |
745 details = document.createTextNode(detailsText); | 752 details = document.createTextNode(detailsText); |
746 return details; | 753 return details; |
747 | 754 |
755 | |
756 /** | |
757 * @param {string} scriptId | |
758 * @param {number} lineNumber | |
759 * @param {number=} columnNumber | |
760 */ | |
761 function linkifyRawLocation(scriptId, lineNumber, columnNumber) | |
762 { | |
763 var location = new WebInspector.DebuggerModel.Location(scriptId, lineNum ber, columnNumber || 0); | |
764 return linkifier.linkifyRawLocation(location, "timeline-details"); | |
765 } | |
766 | |
748 /** | 767 /** |
749 * @param {string} url | 768 * @param {string} url |
750 * @param {number} lineNumber | 769 * @param {number} lineNumber |
751 * @param {number=} columnNumber | 770 * @param {number=} columnNumber |
752 */ | 771 */ |
753 function linkifyLocation(url, lineNumber, columnNumber) | 772 function linkifyLocation(url, lineNumber, columnNumber) |
754 { | 773 { |
755 // FIXME(62725): stack trace line/column numbers are one-based. | 774 // FIXME(62725): stack trace line/column numbers are one-based. |
756 columnNumber = columnNumber ? columnNumber - 1 : 0; | 775 columnNumber = columnNumber ? columnNumber - 1 : 0; |
757 return linkifier.linkifyLocation(url, lineNumber - 1, columnNumber, "tim eline-details"); | 776 return linkifier.linkifyLocation(url, lineNumber - 1, columnNumber, "tim eline-details"); |
758 } | 777 } |
759 | 778 |
760 /** | 779 /** |
761 * @param {!ConsoleAgent.CallFrame} callFrame | 780 * @param {!ConsoleAgent.CallFrame} callFrame |
762 */ | 781 */ |
763 function linkifyCallFrame(callFrame) | 782 function linkifyCallFrame(callFrame) |
764 { | 783 { |
765 return linkifyLocation(callFrame.url, callFrame.lineNumber, callFrame.co lumnNumber); | 784 return linkifyLocation(callFrame.url, callFrame.lineNumber, callFrame.co lumnNumber); |
766 } | 785 } |
767 | 786 |
768 /** | 787 /** |
769 * @return {?Element} | 788 * @return {?Element} |
770 */ | 789 */ |
771 function linkifyTopCallFrame() | 790 function linkifyTopCallFrame() |
772 { | 791 { |
773 if (record.stackTrace) | 792 if (record.stackTrace) |
774 return linkifyCallFrame(record.stackTrace[0]); | 793 return linkifyCallFrame(record.stackTrace[0]); |
pfeldman
2014/03/28 15:17:07
Stacks should be using scriptIds as well.
| |
775 if (record.callSiteStackTrace) | 794 if (record.callSiteStackTrace) |
776 return linkifyCallFrame(record.callSiteStackTrace[0]); | 795 return linkifyCallFrame(record.callSiteStackTrace[0]); |
777 return null; | 796 return null; |
778 } | 797 } |
779 | 798 |
780 /** | 799 /** |
781 * @return {?Element} | 800 * @return {?Element} |
782 */ | 801 */ |
783 function linkifyScriptLocation() | 802 function linkifyScriptLocation() |
784 { | 803 { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
964 for (var i = 0; i < stackTrace.length; ++i) { | 983 for (var i = 0; i < stackTrace.length; ++i) { |
965 var stackFrame = stackTrace[i]; | 984 var stackFrame = stackTrace[i]; |
966 var row = stackTraceElement.createChild("div"); | 985 var row = stackTraceElement.createChild("div"); |
967 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)")); | 986 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)")); |
968 row.createTextChild(" @ "); | 987 row.createTextChild(" @ "); |
969 var urlElement = this._linkifier.linkifyLocation(stackFrame.url, sta ckFrame.lineNumber - 1); | 988 var urlElement = this._linkifier.linkifyLocation(stackFrame.url, sta ckFrame.lineNumber - 1); |
970 row.appendChild(urlElement); | 989 row.appendChild(urlElement); |
971 } | 990 } |
972 } | 991 } |
973 } | 992 } |
OLD | NEW |