| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 * @return {number} | 132 * @return {number} |
| 133 */ | 133 */ |
| 134 maxStackDepth: function() | 134 maxStackDepth: function() |
| 135 { | 135 { |
| 136 return this._currentLevel; | 136 return this._currentLevel; |
| 137 }, | 137 }, |
| 138 | 138 |
| 139 /** | 139 /** |
| 140 * @override | 140 * @override |
| 141 * @param {number} entryIndex | 141 * @param {number} entryIndex |
| 142 * @return {?Array.<!{title: string, value: (string|!Element)}>} | 142 * @return {?Element} |
| 143 */ | 143 */ |
| 144 prepareHighlightedEntryInfo: function(entryIndex) | 144 prepareHighlightedEntryInfo: function(entryIndex) |
| 145 { | 145 { |
| 146 return null; | 146 return null; |
| 147 }, | 147 }, |
| 148 | 148 |
| 149 /** | 149 /** |
| 150 * @override | 150 * @override |
| 151 * @param {number} entryIndex | 151 * @param {number} entryIndex |
| 152 * @return {boolean} | 152 * @return {boolean} |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 * @return {!WebInspector.TimelineFlameChartEntryType} | 628 * @return {!WebInspector.TimelineFlameChartEntryType} |
| 629 */ | 629 */ |
| 630 _entryType: function(entryIndex) | 630 _entryType: function(entryIndex) |
| 631 { | 631 { |
| 632 return this._entryTypeByLevel[this._timelineData.entryLevels[entryIndex]
]; | 632 return this._entryTypeByLevel[this._timelineData.entryLevels[entryIndex]
]; |
| 633 }, | 633 }, |
| 634 | 634 |
| 635 /** | 635 /** |
| 636 * @override | 636 * @override |
| 637 * @param {number} entryIndex | 637 * @param {number} entryIndex |
| 638 * @return {?Array.<!{title: string, value: (string|!Element)}>} | 638 * @return {?Element} |
| 639 */ | 639 */ |
| 640 prepareHighlightedEntryInfo: function(entryIndex) | 640 prepareHighlightedEntryInfo: function(entryIndex) |
| 641 { | 641 { |
| 642 var time = ""; | 642 var time = ""; |
| 643 var title; | 643 var title; |
| 644 var warning; | 644 var warning; |
| 645 var type = this._entryType(entryIndex); | 645 var type = this._entryType(entryIndex); |
| 646 if (type === WebInspector.TimelineFlameChartEntryType.Event) { | 646 if (type === WebInspector.TimelineFlameChartEntryType.Event) { |
| 647 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._e
ntryData[entryIndex]); | 647 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._e
ntryData[entryIndex]); |
| 648 var totalTime = event.duration; | 648 var totalTime = event.duration; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 659 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._entryD
ata[entryIndex]); | 659 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._entryD
ata[entryIndex]); |
| 660 time = WebInspector.UIString("%s ~ %.0f\u2009fps", Number.preciseMil
lisToString(frame.duration, 1), (1000 / frame.duration)); | 660 time = WebInspector.UIString("%s ~ %.0f\u2009fps", Number.preciseMil
lisToString(frame.duration, 1), (1000 / frame.duration)); |
| 661 title = frame.idle ? WebInspector.UIString("Idle Frame") : WebInspec
tor.UIString("Frame"); | 661 title = frame.idle ? WebInspector.UIString("Idle Frame") : WebInspec
tor.UIString("Frame"); |
| 662 if (frame.hasWarnings()) { | 662 if (frame.hasWarnings()) { |
| 663 warning = createElement("span"); | 663 warning = createElement("span"); |
| 664 warning.textContent = WebInspector.UIString("Long frame"); | 664 warning.textContent = WebInspector.UIString("Long frame"); |
| 665 } | 665 } |
| 666 } else { | 666 } else { |
| 667 return null; | 667 return null; |
| 668 } | 668 } |
| 669 var value = createElement("div"); | 669 var element = createElement("div"); |
| 670 var root = WebInspector.createShadowRootWithCoreStyles(value, "timeline/
timelineFlamechartPopover.css"); | 670 var root = WebInspector.createShadowRootWithCoreStyles(element, "timelin
e/timelineFlamechartPopover.css"); |
| 671 var contents = root.createChild("div", "timeline-flamechart-popover"); | 671 var contents = root.createChild("div", "timeline-flamechart-popover"); |
| 672 contents.createChild("span", "timeline-info-time").textContent = time; | 672 contents.createChild("span", "timeline-info-time").textContent = time; |
| 673 contents.createChild("span", "timeline-info-title").textContent = title; | 673 contents.createChild("span", "timeline-info-title").textContent = title; |
| 674 if (warning) { | 674 if (warning) { |
| 675 warning.classList.add("timeline-info-warning"); | 675 warning.classList.add("timeline-info-warning"); |
| 676 contents.appendChild(warning); | 676 contents.appendChild(warning); |
| 677 } | 677 } |
| 678 return [{ title: "", value: value }]; | 678 return element; |
| 679 }, | 679 }, |
| 680 | 680 |
| 681 /** | 681 /** |
| 682 * @override | 682 * @override |
| 683 * @param {number} entryIndex | 683 * @param {number} entryIndex |
| 684 * @return {string} | 684 * @return {string} |
| 685 */ | 685 */ |
| 686 entryColor: function(entryIndex) | 686 entryColor: function(entryIndex) |
| 687 { | 687 { |
| 688 // This is not annotated due to closure compiler failure to properly inf
er cache container's template type. | 688 // This is not annotated due to closure compiler failure to properly inf
er cache container's template type. |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 * @return {boolean} | 1129 * @return {boolean} |
| 1130 */ | 1130 */ |
| 1131 forceDecoration: function(index) | 1131 forceDecoration: function(index) |
| 1132 { | 1132 { |
| 1133 return true; | 1133 return true; |
| 1134 }, | 1134 }, |
| 1135 | 1135 |
| 1136 /** | 1136 /** |
| 1137 * @override | 1137 * @override |
| 1138 * @param {number} index | 1138 * @param {number} index |
| 1139 * @return {?Array<!{title: string, value: (string|!Element)}>} | 1139 * @return {?Element} |
| 1140 */ | 1140 */ |
| 1141 prepareHighlightedEntryInfo: function(index) | 1141 prepareHighlightedEntryInfo: function(index) |
| 1142 { | 1142 { |
| 1143 var /** @const */ maxURLChars = 80; | 1143 var /** @const */ maxURLChars = 80; |
| 1144 var request = /** @type {!WebInspector.TimelineModel.NetworkRequest} */
(this._requests[index]); | 1144 var request = /** @type {!WebInspector.TimelineModel.NetworkRequest} */
(this._requests[index]); |
| 1145 if (!request.url) | 1145 if (!request.url) |
| 1146 return null; | 1146 return null; |
| 1147 var value = createElement("div"); | 1147 var element = createElement("div"); |
| 1148 var root = WebInspector.createShadowRootWithCoreStyles(value, "timeline/
timelineFlamechartPopover.css"); | 1148 var root = WebInspector.createShadowRootWithCoreStyles(element, "timelin
e/timelineFlamechartPopover.css"); |
| 1149 var contents = root.createChild("div", "timeline-flamechart-popover"); | 1149 var contents = root.createChild("div", "timeline-flamechart-popover"); |
| 1150 var duration = request.endTime - request.startTime; | 1150 var duration = request.endTime - request.startTime; |
| 1151 if (request.startTime && isFinite(duration)) | 1151 if (request.startTime && isFinite(duration)) |
| 1152 contents.createChild("span", "timeline-info-network-time").textConte
nt = Number.millisToString(duration); | 1152 contents.createChild("span", "timeline-info-network-time").textConte
nt = Number.millisToString(duration); |
| 1153 if (typeof request.priority === "string") { | 1153 if (typeof request.priority === "string") { |
| 1154 var div = contents.createChild("span"); | 1154 var div = contents.createChild("span"); |
| 1155 div.textContent = WebInspector.uiLabelForPriority(/** @type {!Networ
kAgent.ResourcePriority} */ (request.priority)); | 1155 div.textContent = WebInspector.uiLabelForPriority(/** @type {!Networ
kAgent.ResourcePriority} */ (request.priority)); |
| 1156 div.style.color = this._colorForPriority(request.priority) || "black
"; | 1156 div.style.color = this._colorForPriority(request.priority) || "black
"; |
| 1157 } | 1157 } |
| 1158 contents.createChild("span").textContent = request.url.trimMiddle(maxURL
Chars); | 1158 contents.createChild("span").textContent = request.url.trimMiddle(maxURL
Chars); |
| 1159 return [{ title: "", value: value }]; | 1159 return element; |
| 1160 }, | 1160 }, |
| 1161 | 1161 |
| 1162 /** | 1162 /** |
| 1163 * @param {string} priority | 1163 * @param {string} priority |
| 1164 * @return {?string} | 1164 * @return {?string} |
| 1165 */ | 1165 */ |
| 1166 _colorForPriority: function(priority) | 1166 _colorForPriority: function(priority) |
| 1167 { | 1167 { |
| 1168 switch (/** @type {!NetworkAgent.ResourcePriority} */ (priority)) { | 1168 switch (/** @type {!NetworkAgent.ResourcePriority} */ (priority)) { |
| 1169 case NetworkAgent.ResourcePriority.VeryLow: return "#080"; | 1169 case NetworkAgent.ResourcePriority.VeryLow: return "#080"; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 /** | 1516 /** |
| 1517 * @constructor | 1517 * @constructor |
| 1518 * @param {!WebInspector.TimelineSelection} selection | 1518 * @param {!WebInspector.TimelineSelection} selection |
| 1519 * @param {number} entryIndex | 1519 * @param {number} entryIndex |
| 1520 */ | 1520 */ |
| 1521 WebInspector.TimelineFlameChartView.Selection = function(selection, entryIndex) | 1521 WebInspector.TimelineFlameChartView.Selection = function(selection, entryIndex) |
| 1522 { | 1522 { |
| 1523 this.timelineSelection = selection; | 1523 this.timelineSelection = selection; |
| 1524 this.entryIndex = entryIndex; | 1524 this.entryIndex = entryIndex; |
| 1525 } | 1525 } |
| OLD | NEW |