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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1020 title = WebInspector.UIString("Style Invalidations"); | 1020 title = WebInspector.UIString("Style Invalidations"); |
1021 break; | 1021 break; |
1022 case WebInspector.TimelineModel.RecordType.LayoutInvalidationTracking: | 1022 case WebInspector.TimelineModel.RecordType.LayoutInvalidationTracking: |
1023 title = WebInspector.UIString("Layout Invalidations"); | 1023 title = WebInspector.UIString("Layout Invalidations"); |
1024 break; | 1024 break; |
1025 default: | 1025 default: |
1026 title = WebInspector.UIString("Other Invalidations"); | 1026 title = WebInspector.UIString("Other Invalidations"); |
1027 break; | 1027 break; |
1028 } | 1028 } |
1029 | 1029 |
1030 var detailsNode = createElementWithClass("div", "timeline-details-view-row") ; | |
1031 var titleElement = detailsNode.createChild("span", "timeline-details-view-ro w-title"); | |
1032 titleElement.textContent = WebInspector.UIString("%s: ", title); | |
1033 | |
1034 var invalidationsTreeOutline = new TreeOutlineInShadow(); | 1030 var invalidationsTreeOutline = new TreeOutlineInShadow(); |
1035 invalidationsTreeOutline.registerRequiredCSS("timeline/invalidationsTree.css "); | 1031 invalidationsTreeOutline.registerRequiredCSS("timeline/invalidationsTree.css "); |
1036 invalidationsTreeOutline.element.classList.add("timeline-details-view-row-va lue", "invalidations-tree"); | 1032 invalidationsTreeOutline.element.classList.add("invalidations-tree"); |
1037 detailsNode.appendChild(invalidationsTreeOutline.element); | |
1038 | 1033 |
1039 var invalidationGroups = groupInvalidationsByCause(invalidations); | 1034 var invalidationGroups = groupInvalidationsByCause(invalidations); |
1040 invalidationGroups.forEach(function(group) { | 1035 invalidationGroups.forEach(function(group) { |
1041 var groupElement = new WebInspector.TimelineUIUtils.InvalidationsGroupEl ement(target, relatedNodesMap, contentHelper, group); | 1036 var groupElement = new WebInspector.TimelineUIUtils.InvalidationsGroupEl ement(target, relatedNodesMap, contentHelper, group); |
1042 invalidationsTreeOutline.appendChild(groupElement); | 1037 invalidationsTreeOutline.appendChild(groupElement); |
1043 }); | 1038 }); |
1044 contentHelper.element.appendChild(detailsNode); | 1039 contentHelper.appendElementRow(title, invalidationsTreeOutline.element); |
1045 | 1040 |
1046 /** | 1041 /** |
1047 * @param {!Array.<!WebInspector.InvalidationTrackingEvent>} invalidations | 1042 * @param {!Array.<!WebInspector.InvalidationTrackingEvent>} invalidations |
1048 */ | 1043 */ |
1049 function groupInvalidationsByCause(invalidations) | 1044 function groupInvalidationsByCause(invalidations) |
1050 { | 1045 { |
1051 var causeToInvalidationMap = {}; | 1046 var causeToInvalidationMap = {}; |
1052 for (var index = 0; index < invalidations.length; index++) { | 1047 for (var index = 0; index < invalidations.length; index++) { |
1053 var invalidation = invalidations[index]; | 1048 var invalidation = invalidations[index]; |
1054 var causeKey = ""; | 1049 var causeKey = ""; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1120 var topFrame = first.cause.stackTrace && first.cause.stackTrace[0]; | 1115 var topFrame = first.cause.stackTrace && first.cause.stackTrace[0]; |
1121 | 1116 |
1122 var title = createElement("span"); | 1117 var title = createElement("span"); |
1123 if (reason) | 1118 if (reason) |
1124 title.createTextChild(WebInspector.UIString("%s for ", reason)); | 1119 title.createTextChild(WebInspector.UIString("%s for ", reason)); |
1125 else | 1120 else |
1126 title.createTextChild(WebInspector.UIString("Unknown cause for ")); | 1121 title.createTextChild(WebInspector.UIString("Unknown cause for ")); |
1127 | 1122 |
1128 this._appendTruncatedNodeList(title, this._invalidations); | 1123 this._appendTruncatedNodeList(title, this._invalidations); |
1129 | 1124 |
1130 if (topFrame && this._contentHelper.linkifier()) { | 1125 if (topFrame && this._contentHelper.linkifier()) { |
pfeldman
2015/12/09 16:36:39
Another misuse of the content helper - should add
| |
1131 title.createTextChild(WebInspector.UIString(". ")); | 1126 title.createTextChild(WebInspector.UIString(". ")); |
1132 var stack = title.createChild("span", "monospace"); | 1127 var stack = title.createChild("span", "monospace"); |
1133 stack.createChild("span").textContent = WebInspector.beautifyFunctio nName(topFrame.functionName); | 1128 stack.createChild("span").textContent = WebInspector.beautifyFunctio nName(topFrame.functionName); |
1134 stack.createChild("span").textContent = " @ "; | 1129 stack.createChild("span").textContent = " @ "; |
1135 stack.createChild("span").appendChild(this._contentHelper.linkifier( ).linkifyConsoleCallFrame(target, topFrame)); | 1130 stack.createChild("span").appendChild(this._contentHelper.linkifier( ).linkifyConsoleCallFrame(target, topFrame)); |
1136 } | 1131 } |
1137 | 1132 |
1138 return title; | 1133 return title; |
1139 }, | 1134 }, |
1140 | 1135 |
1141 /** | 1136 /** |
1142 * @override | 1137 * @override |
1143 */ | 1138 */ |
1144 onpopulate: function() | 1139 onpopulate: function() |
1145 { | 1140 { |
1146 var content = createElementWithClass("div", "content"); | 1141 var content = createElementWithClass("div", "content"); |
1147 | 1142 |
1148 var first = this._invalidations[0]; | 1143 var first = this._invalidations[0]; |
1149 if (first.cause.stackTrace) { | 1144 if (first.cause.stackTrace) { |
1150 var stack = content.createChild("div"); | 1145 var stack = content.createChild("div"); |
1151 stack.createTextChild(WebInspector.UIString("Stack trace:")); | 1146 stack.createTextChild(WebInspector.UIString("Stack trace:")); |
1152 this._contentHelper.createChildStackTraceElement(stack, first.cause. stackTrace); | 1147 this._contentHelper.createChildStackTraceElement(stack, first.cause. stackTrace); |
pfeldman
2015/12/09 16:36:39
This is also a misuse of the helper. You should on
| |
1153 } | 1148 } |
1154 | 1149 |
1155 content.createTextChild(this._invalidations.length > 1 ? WebInspector.UI String("Nodes:") : WebInspector.UIString("Node:")); | 1150 content.createTextChild(this._invalidations.length > 1 ? WebInspector.UI String("Nodes:") : WebInspector.UIString("Node:")); |
1156 var nodeList = content.createChild("div", "node-list"); | 1151 var nodeList = content.createChild("div", "node-list"); |
1157 var firstNode = true; | 1152 var firstNode = true; |
1158 for (var i = 0; i < this._invalidations.length; i++) { | 1153 for (var i = 0; i < this._invalidations.length; i++) { |
1159 var invalidation = this._invalidations[i]; | 1154 var invalidation = this._invalidations[i]; |
1160 var invalidationNode = this._createInvalidationNode(invalidation, tr ue); | 1155 var invalidationNode = this._createInvalidationNode(invalidation, tr ue); |
1161 if (invalidationNode) { | 1156 if (invalidationNode) { |
1162 if (!firstNode) | 1157 if (!firstNode) |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1935 this._target = target; | 1930 this._target = target; |
1936 this.element = createElement("div"); | 1931 this.element = createElement("div"); |
1937 this.element.className = "timeline-details-view-block"; | 1932 this.element.className = "timeline-details-view-block"; |
1938 this._monospaceValues = monospaceValues; | 1933 this._monospaceValues = monospaceValues; |
1939 } | 1934 } |
1940 | 1935 |
1941 WebInspector.TimelineDetailsContentHelper.prototype = { | 1936 WebInspector.TimelineDetailsContentHelper.prototype = { |
1942 /** | 1937 /** |
1943 * @return {?WebInspector.Linkifier} | 1938 * @return {?WebInspector.Linkifier} |
1944 */ | 1939 */ |
1945 linkifier: function() | 1940 linkifier: function() |
pfeldman
2015/12/09 16:36:39
It is easy to spot the abusing call sites - they a
| |
1946 { | 1941 { |
1947 return this._linkifier; | 1942 return this._linkifier; |
1948 }, | 1943 }, |
1949 | 1944 |
1950 /** | 1945 /** |
1951 * @param {string} title | 1946 * @param {string} title |
1952 * @param {string|number|boolean} value | 1947 * @param {string|number|boolean} value |
1953 */ | 1948 */ |
1954 appendTextRow: function(title, value) | 1949 appendTextRow: function(title, value) |
1955 { | 1950 { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2019 | 2014 |
2020 var rowElement = this.element.createChild("div", "timeline-details-view- row"); | 2015 var rowElement = this.element.createChild("div", "timeline-details-view- row"); |
2021 rowElement.createChild("div", "timeline-details-view-row-title").textCon tent = title; | 2016 rowElement.createChild("div", "timeline-details-view-row-title").textCon tent = title; |
2022 this.createChildStackTraceElement(rowElement, stackTrace); | 2017 this.createChildStackTraceElement(rowElement, stackTrace); |
2023 }, | 2018 }, |
2024 | 2019 |
2025 /** | 2020 /** |
2026 * @param {!Element} parentElement | 2021 * @param {!Element} parentElement |
2027 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace | 2022 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace |
2028 */ | 2023 */ |
2029 createChildStackTraceElement: function(parentElement, stackTrace) | 2024 createChildStackTraceElement: function(parentElement, stackTrace) |
pfeldman
2015/12/09 16:36:39
And this one.
| |
2030 { | 2025 { |
2031 if (!this._linkifier || !this._target) | 2026 if (!this._linkifier || !this._target) |
2032 return; | 2027 return; |
2033 | 2028 |
2034 var stackTraceElement = parentElement.createChild("div", "timeline-detai ls-view-row-value timeline-details-view-row-stack-trace monospace"); | 2029 var stackTraceElement = parentElement.createChild("div", "timeline-detai ls-view-row-value timeline-details-view-row-stack-trace monospace"); |
2035 | 2030 |
2036 var callFrameElem = WebInspector.DOMPresentationUtils.buildStackTracePre viewContents(this._target, this._linkifier, stackTrace); | 2031 var callFrameElem = WebInspector.DOMPresentationUtils.buildStackTracePre viewContents(this._target, this._linkifier, stackTrace); |
2037 | 2032 |
2038 stackTraceElement.appendChild(callFrameElem); | 2033 stackTraceElement.appendChild(callFrameElem); |
2039 }, | 2034 }, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2078 case warnings.V8Deopt: | 2073 case warnings.V8Deopt: |
2079 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", | 2074 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", |
2080 WebInspector.UIString("Not optimized"), undefined, true)); | 2075 WebInspector.UIString("Not optimized"), undefined, true)); |
2081 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); | 2076 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); |
2082 break; | 2077 break; |
2083 default: | 2078 default: |
2084 console.assert(false, "Unhandled TimelineModel.WarningType"); | 2079 console.assert(false, "Unhandled TimelineModel.WarningType"); |
2085 } | 2080 } |
2086 return span; | 2081 return span; |
2087 } | 2082 } |
OLD | NEW |