Chromium Code Reviews| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 return true; | 212 return true; |
| 213 case recordTypes.MarkDOMContent: | 213 case recordTypes.MarkDOMContent: |
| 214 case recordTypes.MarkLoad: | 214 case recordTypes.MarkLoad: |
| 215 return event.args["data"]["isMainFrame"]; | 215 return event.args["data"]["isMainFrame"]; |
| 216 default: | 216 default: |
| 217 return false; | 217 return false; |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 /** | 221 /** |
| 222 * @param {!ConsoleAgent.CallFrame} frame | 222 * @param {!RuntimeAgent.CallFrame} frame |
| 223 * @return {boolean} | 223 * @return {boolean} |
| 224 */ | 224 */ |
| 225 WebInspector.TimelineUIUtils.isUserFrame = function(frame) | 225 WebInspector.TimelineUIUtils.isUserFrame = function(frame) |
| 226 { | 226 { |
| 227 return frame.scriptId !== "0" && !frame.url.startsWith("native "); | 227 return frame.scriptId !== "0" && !frame.url.startsWith("native "); |
| 228 } | 228 } |
| 229 | 229 |
| 230 /** | 230 /** |
| 231 * @param {!WebInspector.TracingModel.Event} event | 231 * @param {!WebInspector.TracingModel.Event} event |
| 232 * @return {?ConsoleAgent.CallFrame} | 232 * @return {?RuntimeAgent.CallFrame} |
| 233 */ | 233 */ |
| 234 WebInspector.TimelineUIUtils.topStackFrame = function(event) | 234 WebInspector.TimelineUIUtils.topStackFrame = function(event) |
| 235 { | 235 { |
| 236 var stackTrace = event.stackTrace || event.initiator && event.initiator.stac kTrace; | 236 var callFrames = event.stackTrace; |
| 237 return stackTrace && stackTrace.length ? stackTrace[0] : null; | 237 if (!callFrames) |
| 238 callFrames = event.initiator && event.initiator.stack ? event.initiator. stack.callFrames : null; | |
|
dgozman
2016/02/04 01:43:06
Double-check.
pfeldman
2016/02/04 03:16:00
Done.
| |
| 239 return callFrames && callFrames.length ? callFrames[0] : null; | |
| 238 } | 240 } |
| 239 | 241 |
| 240 /** | 242 /** |
| 241 * @enum {symbol} | 243 * @enum {symbol} |
| 242 */ | 244 */ |
| 243 WebInspector.TimelineUIUtils.NetworkCategory = { | 245 WebInspector.TimelineUIUtils.NetworkCategory = { |
| 244 HTML: Symbol("HTML"), | 246 HTML: Symbol("HTML"), |
| 245 Script: Symbol("Script"), | 247 Script: Symbol("Script"), |
| 246 Style: Symbol("Style"), | 248 Style: Symbol("Style"), |
| 247 Media: Symbol("Media"), | 249 Media: Symbol("Media"), |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 740 | 742 |
| 741 var relatedNode = relatedNodesMap && relatedNodesMap.get(event.backendNodeId ); | 743 var relatedNode = relatedNodesMap && relatedNodesMap.get(event.backendNodeId ); |
| 742 if (relatedNode) | 744 if (relatedNode) |
| 743 contentHelper.appendElementRow(relatedNodeLabel || WebInspector.UIString ("Related Node"), WebInspector.DOMPresentationUtils.linkifyNodeReference(related Node)); | 745 contentHelper.appendElementRow(relatedNodeLabel || WebInspector.UIString ("Related Node"), WebInspector.DOMPresentationUtils.linkifyNodeReference(related Node)); |
| 744 | 746 |
| 745 if (event.previewElement) { | 747 if (event.previewElement) { |
| 746 contentHelper.addSection(WebInspector.UIString("Preview")); | 748 contentHelper.addSection(WebInspector.UIString("Preview")); |
| 747 contentHelper.appendElementRow("", event.previewElement); | 749 contentHelper.appendElementRow("", event.previewElement); |
| 748 } | 750 } |
| 749 | 751 |
| 750 if (event.stackTrace || (event.initiator && event.initiator.stackTrace) || e vent.invalidationTrackingEvents) | 752 if (event.stackTrace || (event.initiator && event.initiator.stack) || event. invalidationTrackingEvents) |
| 751 WebInspector.TimelineUIUtils._generateCauses(event, model.target(), rela tedNodesMap, contentHelper); | 753 WebInspector.TimelineUIUtils._generateCauses(event, model.target(), rela tedNodesMap, contentHelper); |
| 752 | 754 |
| 753 var showPieChart = detailed && WebInspector.TimelineUIUtils._aggregatedStats ForTraceEvent(stats, model, event); | 755 var showPieChart = detailed && WebInspector.TimelineUIUtils._aggregatedStats ForTraceEvent(stats, model, event); |
| 754 if (showPieChart) { | 756 if (showPieChart) { |
| 755 contentHelper.addSection(WebInspector.UIString("Aggregated Time")); | 757 contentHelper.addSection(WebInspector.UIString("Aggregated Time")); |
| 756 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(stats, WebI nspector.TimelineUIUtils.eventStyle(event).category, event.selfTime); | 758 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(stats, WebI nspector.TimelineUIUtils.eventStyle(event).category, event.selfTime); |
| 757 contentHelper.appendElementRow("", pieChart); | 759 contentHelper.appendElementRow("", pieChart); |
| 758 } | 760 } |
| 759 | 761 |
| 760 return contentHelper.fragment; | 762 return contentHelper.fragment; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 913 function appendPreview(element) | 915 function appendPreview(element) |
| 914 { | 916 { |
| 915 if (element) | 917 if (element) |
| 916 contentHelper.appendElementRow(WebInspector.UIString("Preview"), req uest.previewElement); | 918 contentHelper.appendElementRow(WebInspector.UIString("Preview"), req uest.previewElement); |
| 917 return contentHelper.fragment; | 919 return contentHelper.fragment; |
| 918 } | 920 } |
| 919 return previewPromise.then(appendPreview); | 921 return previewPromise.then(appendPreview); |
| 920 } | 922 } |
| 921 | 923 |
| 922 /** | 924 /** |
| 925 * @param {!Array<!RuntimeAgent.CallFrame>} callFrames | |
| 926 * @return {!RuntimeAgent.StackTrace} | |
| 927 */ | |
| 928 WebInspector.TimelineUIUtils._stackTraceFromCallFrames = function(callFrames) | |
| 929 { | |
| 930 return /** @type {!RuntimeAgent.StackTrace} */ ({ callFrames: callFrames }); | |
| 931 } | |
| 932 | |
| 933 /** | |
| 923 * @param {!WebInspector.TracingModel.Event} event | 934 * @param {!WebInspector.TracingModel.Event} event |
| 924 * @param {?WebInspector.Target} target | 935 * @param {?WebInspector.Target} target |
| 925 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap | 936 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap |
| 926 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper | 937 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper |
| 927 */ | 938 */ |
| 928 WebInspector.TimelineUIUtils._generateCauses = function(event, target, relatedNo desMap, contentHelper) | 939 WebInspector.TimelineUIUtils._generateCauses = function(event, target, relatedNo desMap, contentHelper) |
| 929 { | 940 { |
| 930 var recordTypes = WebInspector.TimelineModel.RecordType; | 941 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 931 | 942 |
| 932 var callSiteStackLabel; | 943 var callSiteStackLabel; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 949 break; | 960 break; |
| 950 case recordTypes.Layout: | 961 case recordTypes.Layout: |
| 951 callSiteStackLabel = WebInspector.UIString("First Layout Invalidation"); | 962 callSiteStackLabel = WebInspector.UIString("First Layout Invalidation"); |
| 952 stackLabel = WebInspector.UIString("Layout Forced"); | 963 stackLabel = WebInspector.UIString("Layout Forced"); |
| 953 break; | 964 break; |
| 954 } | 965 } |
| 955 | 966 |
| 956 // Direct cause. | 967 // Direct cause. |
| 957 if (event.stackTrace && event.stackTrace.length) { | 968 if (event.stackTrace && event.stackTrace.length) { |
| 958 contentHelper.addSection(WebInspector.UIString("Call Stacks")); | 969 contentHelper.addSection(WebInspector.UIString("Call Stacks")); |
| 959 contentHelper.appendStackTrace(stackLabel || WebInspector.UIString("Stac k Trace"), event.stackTrace); | 970 contentHelper.appendStackTrace(stackLabel || WebInspector.UIString("Stac k Trace"), WebInspector.TimelineUIUtils._stackTraceFromCallFrames(event.stackTra ce)); |
| 960 } | 971 } |
| 961 | 972 |
| 962 // Indirect causes. | 973 // Indirect causes. |
| 963 if (event.invalidationTrackingEvents && target) { // Full invalidation track ing (experimental). | 974 if (event.invalidationTrackingEvents && target) { // Full invalidation track ing (experimental). |
| 964 contentHelper.addSection(WebInspector.UIString("Invalidations")); | 975 contentHelper.addSection(WebInspector.UIString("Invalidations")); |
| 965 WebInspector.TimelineUIUtils._generateInvalidations(event, target, relat edNodesMap, contentHelper); | 976 WebInspector.TimelineUIUtils._generateInvalidations(event, target, relat edNodesMap, contentHelper); |
| 966 } else if (initiator && initiator.stackTrace) { // Partial invalidation trac king. | 977 } else if (initiator && initiator.stack) { // Partial invalidation tracking. |
| 967 contentHelper.appendStackTrace(callSiteStackLabel || WebInspector.UIStri ng("First Invalidated"), initiator.stackTrace); | 978 contentHelper.appendStackTrace(callSiteStackLabel || WebInspector.UIStri ng("First Invalidated"), initiator.stack); |
| 968 } | 979 } |
| 969 } | 980 } |
| 970 | 981 |
| 971 /** | 982 /** |
| 972 * @param {!WebInspector.TracingModel.Event} event | 983 * @param {!WebInspector.TracingModel.Event} event |
| 973 * @param {!WebInspector.Target} target | 984 * @param {!WebInspector.Target} target |
| 974 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap | 985 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap |
| 975 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper | 986 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper |
| 976 */ | 987 */ |
| 977 WebInspector.TimelineUIUtils._generateInvalidations = function(event, target, re latedNodesMap, contentHelper) | 988 WebInspector.TimelineUIUtils._generateInvalidations = function(event, target, re latedNodesMap, contentHelper) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1125 * @override | 1136 * @override |
| 1126 */ | 1137 */ |
| 1127 onpopulate: function() | 1138 onpopulate: function() |
| 1128 { | 1139 { |
| 1129 var content = createElementWithClass("div", "content"); | 1140 var content = createElementWithClass("div", "content"); |
| 1130 | 1141 |
| 1131 var first = this._invalidations[0]; | 1142 var first = this._invalidations[0]; |
| 1132 if (first.cause.stackTrace) { | 1143 if (first.cause.stackTrace) { |
| 1133 var stack = content.createChild("div"); | 1144 var stack = content.createChild("div"); |
| 1134 stack.createTextChild(WebInspector.UIString("Stack trace:")); | 1145 stack.createTextChild(WebInspector.UIString("Stack trace:")); |
| 1135 this._contentHelper.createChildStackTraceElement(stack, first.cause. stackTrace); | 1146 this._contentHelper.createChildStackTraceElement(stack, WebInspector .TimelineUIUtils._stackTraceFromCallFrames(first.cause.stackTrace)); |
| 1136 } | 1147 } |
| 1137 | 1148 |
| 1138 content.createTextChild(this._invalidations.length > 1 ? WebInspector.UI String("Nodes:") : WebInspector.UIString("Node:")); | 1149 content.createTextChild(this._invalidations.length > 1 ? WebInspector.UI String("Nodes:") : WebInspector.UIString("Node:")); |
| 1139 var nodeList = content.createChild("div", "node-list"); | 1150 var nodeList = content.createChild("div", "node-list"); |
| 1140 var firstNode = true; | 1151 var firstNode = true; |
| 1141 for (var i = 0; i < this._invalidations.length; i++) { | 1152 for (var i = 0; i < this._invalidations.length; i++) { |
| 1142 var invalidation = this._invalidations[i]; | 1153 var invalidation = this._invalidations[i]; |
| 1143 var invalidationNode = this._createInvalidationNode(invalidation, tr ue); | 1154 var invalidationNode = this._createInvalidationNode(invalidation, tr ue); |
| 1144 if (invalidationNode) { | 1155 if (invalidationNode) { |
| 1145 if (!firstNode) | 1156 if (!firstNode) |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1945 if (!this._linkifier || !this._target) | 1956 if (!this._linkifier || !this._target) |
| 1946 return; | 1957 return; |
| 1947 var locationContent = createElement("span"); | 1958 var locationContent = createElement("span"); |
| 1948 locationContent.appendChild(this._linkifier.linkifyScriptLocation(this._ target, null, url, startLine - 1)); | 1959 locationContent.appendChild(this._linkifier.linkifyScriptLocation(this._ target, null, url, startLine - 1)); |
| 1949 locationContent.createTextChild(String.sprintf(" [%s\u2026%s]", startLin e, endLine || "")); | 1960 locationContent.createTextChild(String.sprintf(" [%s\u2026%s]", startLin e, endLine || "")); |
| 1950 this.appendElementRow(title, locationContent); | 1961 this.appendElementRow(title, locationContent); |
| 1951 }, | 1962 }, |
| 1952 | 1963 |
| 1953 /** | 1964 /** |
| 1954 * @param {string} title | 1965 * @param {string} title |
| 1955 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace | 1966 * @param {!RuntimeAgent.StackTrace} stackTrace |
| 1956 */ | 1967 */ |
| 1957 appendStackTrace: function(title, stackTrace) | 1968 appendStackTrace: function(title, stackTrace) |
| 1958 { | 1969 { |
| 1959 if (!this._linkifier || !this._target) | 1970 if (!this._linkifier || !this._target) |
| 1960 return; | 1971 return; |
| 1961 | 1972 |
| 1962 var rowElement = this._tableElement.createChild("div", "timeline-details -view-row"); | 1973 var rowElement = this._tableElement.createChild("div", "timeline-details -view-row"); |
| 1963 rowElement.createChild("div", "timeline-details-view-row-title").textCon tent = title; | 1974 rowElement.createChild("div", "timeline-details-view-row-title").textCon tent = title; |
| 1964 this.createChildStackTraceElement(rowElement, stackTrace); | 1975 this.createChildStackTraceElement(rowElement, stackTrace); |
| 1965 }, | 1976 }, |
| 1966 | 1977 |
| 1967 /** | 1978 /** |
| 1968 * @param {!Element} parentElement | 1979 * @param {!Element} parentElement |
| 1969 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace | 1980 * @param {!RuntimeAgent.StackTrace} stackTrace |
| 1970 */ | 1981 */ |
| 1971 createChildStackTraceElement: function(parentElement, stackTrace) | 1982 createChildStackTraceElement: function(parentElement, stackTrace) |
| 1972 { | 1983 { |
| 1973 if (!this._linkifier || !this._target) | 1984 if (!this._linkifier || !this._target) |
| 1974 return; | 1985 return; |
| 1975 parentElement.classList.add("timeline-details-stack-values"); | 1986 parentElement.classList.add("timeline-details-stack-values"); |
| 1976 var stackTraceElement = parentElement.createChild("div", "timeline-detai ls-view-row-value timeline-details-view-row-stack-trace"); | 1987 var stackTraceElement = parentElement.createChild("div", "timeline-detai ls-view-row-value timeline-details-view-row-stack-trace"); |
| 1977 var callFrameElem = WebInspector.DOMPresentationUtils.buildStackTracePre viewContents(this._target, this._linkifier, stackTrace); | 1988 var callFrameElem = WebInspector.DOMPresentationUtils.buildStackTracePre viewContents(this._target, this._linkifier, stackTrace); |
| 1978 stackTraceElement.appendChild(callFrameElem); | 1989 stackTraceElement.appendChild(callFrameElem); |
| 1979 }, | 1990 }, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2018 case warnings.V8Deopt: | 2029 case warnings.V8Deopt: |
| 2019 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", | 2030 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", |
| 2020 WebInspector.UIString("Not optimized"), undefined, true)); | 2031 WebInspector.UIString("Not optimized"), undefined, true)); |
| 2021 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); | 2032 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); |
| 2022 break; | 2033 break; |
| 2023 default: | 2034 default: |
| 2024 console.assert(false, "Unhandled TimelineModel.WarningType"); | 2035 console.assert(false, "Unhandled TimelineModel.WarningType"); |
| 2025 } | 2036 } |
| 2026 return span; | 2037 return span; |
| 2027 } | 2038 } |
| OLD | NEW |