| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 return true; | 251 return true; |
| 252 case recordTypes.MarkDOMContent: | 252 case recordTypes.MarkDOMContent: |
| 253 case recordTypes.MarkLoad: | 253 case recordTypes.MarkLoad: |
| 254 return event.args["data"]["isMainFrame"]; | 254 return event.args["data"]["isMainFrame"]; |
| 255 default: | 255 default: |
| 256 return false; | 256 return false; |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 /** | 260 /** |
| 261 * @param {!ConsoleAgent.CallFrame} frame | 261 * @param {!RuntimeAgent.CallFrame} frame |
| 262 * @return {boolean} | 262 * @return {boolean} |
| 263 */ | 263 */ |
| 264 WebInspector.TimelineUIUtils.isUserFrame = function(frame) | 264 WebInspector.TimelineUIUtils.isUserFrame = function(frame) |
| 265 { | 265 { |
| 266 return frame.scriptId !== "0" && !frame.url.startsWith("native "); | 266 return frame.scriptId !== "0" && !frame.url.startsWith("native "); |
| 267 } | 267 } |
| 268 | 268 |
| 269 /** | 269 /** |
| 270 * @param {!WebInspector.TracingModel.Event} event | 270 * @param {!WebInspector.TracingModel.Event} event |
| 271 * @return {?ConsoleAgent.CallFrame} | 271 * @return {?RuntimeAgent.CallFrame} |
| 272 */ | 272 */ |
| 273 WebInspector.TimelineUIUtils.topStackFrame = function(event) | 273 WebInspector.TimelineUIUtils.topStackFrame = function(event) |
| 274 { | 274 { |
| 275 var stackTrace = event.stackTrace || event.initiator && event.initiator.stac
kTrace; | 275 var stackTrace = event.stackTrace || event.initiator && event.initiator.stac
kTrace; |
| 276 return stackTrace && stackTrace.length ? stackTrace[0] : null; | 276 return stackTrace && stackTrace.length ? stackTrace[0] : null; |
| 277 } | 277 } |
| 278 | 278 |
| 279 /** | 279 /** |
| 280 * @enum {symbol} | 280 * @enum {symbol} |
| 281 */ | 281 */ |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 function appendPreview(element) | 952 function appendPreview(element) |
| 953 { | 953 { |
| 954 if (element) | 954 if (element) |
| 955 contentHelper.appendElementRow(WebInspector.UIString("Preview"), req
uest.previewElement); | 955 contentHelper.appendElementRow(WebInspector.UIString("Preview"), req
uest.previewElement); |
| 956 return contentHelper.fragment; | 956 return contentHelper.fragment; |
| 957 } | 957 } |
| 958 return previewPromise.then(appendPreview); | 958 return previewPromise.then(appendPreview); |
| 959 } | 959 } |
| 960 | 960 |
| 961 /** | 961 /** |
| 962 * @param {!Array<!RuntimeAgent.CallFrame>} callFrames |
| 963 * @return {!RuntimeAgent.StackTrace} |
| 964 */ |
| 965 WebInspector.TimelineUIUtils._stackTraceFromCallFrames = function(callFrames) |
| 966 { |
| 967 return /** @type {!RuntimeAgent.StackTrace} */ ({ callFrames: callFrames }); |
| 968 } |
| 969 |
| 970 /** |
| 962 * @param {!WebInspector.TracingModel.Event} event | 971 * @param {!WebInspector.TracingModel.Event} event |
| 963 * @param {?WebInspector.Target} target | 972 * @param {?WebInspector.Target} target |
| 964 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap | 973 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap |
| 965 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper | 974 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper |
| 966 */ | 975 */ |
| 967 WebInspector.TimelineUIUtils._generateCauses = function(event, target, relatedNo
desMap, contentHelper) | 976 WebInspector.TimelineUIUtils._generateCauses = function(event, target, relatedNo
desMap, contentHelper) |
| 968 { | 977 { |
| 969 var recordTypes = WebInspector.TimelineModel.RecordType; | 978 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 970 | 979 |
| 971 var callSiteStackLabel; | 980 var callSiteStackLabel; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 988 break; | 997 break; |
| 989 case recordTypes.Layout: | 998 case recordTypes.Layout: |
| 990 callSiteStackLabel = WebInspector.UIString("First Layout Invalidation"); | 999 callSiteStackLabel = WebInspector.UIString("First Layout Invalidation"); |
| 991 stackLabel = WebInspector.UIString("Layout Forced"); | 1000 stackLabel = WebInspector.UIString("Layout Forced"); |
| 992 break; | 1001 break; |
| 993 } | 1002 } |
| 994 | 1003 |
| 995 // Direct cause. | 1004 // Direct cause. |
| 996 if (event.stackTrace && event.stackTrace.length) { | 1005 if (event.stackTrace && event.stackTrace.length) { |
| 997 contentHelper.addSection(WebInspector.UIString("Call Stacks")); | 1006 contentHelper.addSection(WebInspector.UIString("Call Stacks")); |
| 998 contentHelper.appendStackTrace(stackLabel || WebInspector.UIString("Stac
k Trace"), event.stackTrace); | 1007 contentHelper.appendStackTrace(stackLabel || WebInspector.UIString("Stac
k Trace"), WebInspector.TimelineUIUtils._stackTraceFromCallFrames(event.stackTra
ce)); |
| 999 } | 1008 } |
| 1000 | 1009 |
| 1001 // Indirect causes. | 1010 // Indirect causes. |
| 1002 if (event.invalidationTrackingEvents && target) { // Full invalidation track
ing (experimental). | 1011 if (event.invalidationTrackingEvents && target) { // Full invalidation track
ing (experimental). |
| 1003 contentHelper.addSection(WebInspector.UIString("Invalidations")); | 1012 contentHelper.addSection(WebInspector.UIString("Invalidations")); |
| 1004 WebInspector.TimelineUIUtils._generateInvalidations(event, target, relat
edNodesMap, contentHelper); | 1013 WebInspector.TimelineUIUtils._generateInvalidations(event, target, relat
edNodesMap, contentHelper); |
| 1005 } else if (initiator && initiator.stackTrace) { // Partial invalidation trac
king. | 1014 } else if (initiator && initiator.stackTrace) { // Partial invalidation trac
king. |
| 1006 contentHelper.appendStackTrace(callSiteStackLabel || WebInspector.UIStri
ng("First Invalidated"), initiator.stackTrace); | 1015 contentHelper.appendStackTrace(callSiteStackLabel || WebInspector.UIStri
ng("First Invalidated"), WebInspector.TimelineUIUtils._stackTraceFromCallFrames(
initiator.stackTrace)); |
| 1007 } | 1016 } |
| 1008 } | 1017 } |
| 1009 | 1018 |
| 1010 /** | 1019 /** |
| 1011 * @param {!WebInspector.TracingModel.Event} event | 1020 * @param {!WebInspector.TracingModel.Event} event |
| 1012 * @param {!WebInspector.Target} target | 1021 * @param {!WebInspector.Target} target |
| 1013 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap | 1022 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap |
| 1014 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper | 1023 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper |
| 1015 */ | 1024 */ |
| 1016 WebInspector.TimelineUIUtils._generateInvalidations = function(event, target, re
latedNodesMap, contentHelper) | 1025 WebInspector.TimelineUIUtils._generateInvalidations = function(event, target, re
latedNodesMap, contentHelper) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 * @override | 1173 * @override |
| 1165 */ | 1174 */ |
| 1166 onpopulate: function() | 1175 onpopulate: function() |
| 1167 { | 1176 { |
| 1168 var content = createElementWithClass("div", "content"); | 1177 var content = createElementWithClass("div", "content"); |
| 1169 | 1178 |
| 1170 var first = this._invalidations[0]; | 1179 var first = this._invalidations[0]; |
| 1171 if (first.cause.stackTrace) { | 1180 if (first.cause.stackTrace) { |
| 1172 var stack = content.createChild("div"); | 1181 var stack = content.createChild("div"); |
| 1173 stack.createTextChild(WebInspector.UIString("Stack trace:")); | 1182 stack.createTextChild(WebInspector.UIString("Stack trace:")); |
| 1174 this._contentHelper.createChildStackTraceElement(stack, first.cause.
stackTrace); | 1183 this._contentHelper.createChildStackTraceElement(stack, WebInspector
.TimelineUIUtils._stackTraceFromCallFrames(first.cause.stackTrace)); |
| 1175 } | 1184 } |
| 1176 | 1185 |
| 1177 content.createTextChild(this._invalidations.length > 1 ? WebInspector.UI
String("Nodes:") : WebInspector.UIString("Node:")); | 1186 content.createTextChild(this._invalidations.length > 1 ? WebInspector.UI
String("Nodes:") : WebInspector.UIString("Node:")); |
| 1178 var nodeList = content.createChild("div", "node-list"); | 1187 var nodeList = content.createChild("div", "node-list"); |
| 1179 var firstNode = true; | 1188 var firstNode = true; |
| 1180 for (var i = 0; i < this._invalidations.length; i++) { | 1189 for (var i = 0; i < this._invalidations.length; i++) { |
| 1181 var invalidation = this._invalidations[i]; | 1190 var invalidation = this._invalidations[i]; |
| 1182 var invalidationNode = this._createInvalidationNode(invalidation, tr
ue); | 1191 var invalidationNode = this._createInvalidationNode(invalidation, tr
ue); |
| 1183 if (invalidationNode) { | 1192 if (invalidationNode) { |
| 1184 if (!firstNode) | 1193 if (!firstNode) |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1985 if (!this._linkifier || !this._target) | 1994 if (!this._linkifier || !this._target) |
| 1986 return; | 1995 return; |
| 1987 var locationContent = createElement("span"); | 1996 var locationContent = createElement("span"); |
| 1988 locationContent.appendChild(this._linkifier.linkifyScriptLocation(this._
target, null, url, startLine - 1)); | 1997 locationContent.appendChild(this._linkifier.linkifyScriptLocation(this._
target, null, url, startLine - 1)); |
| 1989 locationContent.createTextChild(String.sprintf(" [%s\u2026%s]", startLin
e, endLine || "")); | 1998 locationContent.createTextChild(String.sprintf(" [%s\u2026%s]", startLin
e, endLine || "")); |
| 1990 this.appendElementRow(title, locationContent); | 1999 this.appendElementRow(title, locationContent); |
| 1991 }, | 2000 }, |
| 1992 | 2001 |
| 1993 /** | 2002 /** |
| 1994 * @param {string} title | 2003 * @param {string} title |
| 1995 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace | 2004 * @param {!RuntimeAgent.StackTrace} stackTrace |
| 1996 */ | 2005 */ |
| 1997 appendStackTrace: function(title, stackTrace) | 2006 appendStackTrace: function(title, stackTrace) |
| 1998 { | 2007 { |
| 1999 if (!this._linkifier || !this._target) | 2008 if (!this._linkifier || !this._target) |
| 2000 return; | 2009 return; |
| 2001 | 2010 |
| 2002 var rowElement = this._tableElement.createChild("div", "timeline-details
-view-row"); | 2011 var rowElement = this._tableElement.createChild("div", "timeline-details
-view-row"); |
| 2003 rowElement.createChild("div", "timeline-details-view-row-title").textCon
tent = title; | 2012 rowElement.createChild("div", "timeline-details-view-row-title").textCon
tent = title; |
| 2004 this.createChildStackTraceElement(rowElement, stackTrace); | 2013 this.createChildStackTraceElement(rowElement, stackTrace); |
| 2005 }, | 2014 }, |
| 2006 | 2015 |
| 2007 /** | 2016 /** |
| 2008 * @param {!Element} parentElement | 2017 * @param {!Element} parentElement |
| 2009 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace | 2018 * @param {!RuntimeAgent.StackTrace} stackTrace |
| 2010 */ | 2019 */ |
| 2011 createChildStackTraceElement: function(parentElement, stackTrace) | 2020 createChildStackTraceElement: function(parentElement, stackTrace) |
| 2012 { | 2021 { |
| 2013 if (!this._linkifier || !this._target) | 2022 if (!this._linkifier || !this._target) |
| 2014 return; | 2023 return; |
| 2015 parentElement.classList.add("timeline-details-stack-values"); | 2024 parentElement.classList.add("timeline-details-stack-values"); |
| 2016 var stackTraceElement = parentElement.createChild("div", "timeline-detai
ls-view-row-value timeline-details-view-row-stack-trace"); | 2025 var stackTraceElement = parentElement.createChild("div", "timeline-detai
ls-view-row-value timeline-details-view-row-stack-trace"); |
| 2017 var callFrameElem = WebInspector.DOMPresentationUtils.buildStackTracePre
viewContents(this._target, this._linkifier, stackTrace); | 2026 var callFrameElem = WebInspector.DOMPresentationUtils.buildStackTracePre
viewContents(this._target, this._linkifier, stackTrace); |
| 2018 stackTraceElement.appendChild(callFrameElem); | 2027 stackTraceElement.appendChild(callFrameElem); |
| 2019 }, | 2028 }, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 case warnings.V8Deopt: | 2067 case warnings.V8Deopt: |
| 2059 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl
eChrome/devtools-docs/issues/53", | 2068 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl
eChrome/devtools-docs/issues/53", |
| 2060 WebInspector.UIString("Not optimized"), undefined, true)); | 2069 WebInspector.UIString("Not optimized"), undefined, true)); |
| 2061 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso
n"])); | 2070 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso
n"])); |
| 2062 break; | 2071 break; |
| 2063 default: | 2072 default: |
| 2064 console.assert(false, "Unhandled TimelineModel.WarningType"); | 2073 console.assert(false, "Unhandled TimelineModel.WarningType"); |
| 2065 } | 2074 } |
| 2066 return span; | 2075 return span; |
| 2067 } | 2076 } |
| OLD | NEW |