| 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 if (warning) { | 497 if (warning) { |
| 498 warning.classList.add('timeline-info-warning'); | 498 warning.classList.add('timeline-info-warning'); |
| 499 contents.appendChild(warning); | 499 contents.appendChild(warning); |
| 500 } | 500 } |
| 501 return element; | 501 return element; |
| 502 } | 502 } |
| 503 | 503 |
| 504 /** | 504 /** |
| 505 * @override | 505 * @override |
| 506 * @param {number} entryIndex | 506 * @param {number} entryIndex |
| 507 */ | |
| 508 highlightEntry(entryIndex) { | |
| 509 SDK.DOMModel.hideDOMNodeHighlight(); | |
| 510 if (this._entryType(entryIndex) !== Timeline.TimelineFlameChartEntryType.Eve
nt) | |
| 511 return; | |
| 512 var event = /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryInd
ex]); | |
| 513 var target = this._model.targetByEvent(event); | |
| 514 if (!target) | |
| 515 return; | |
| 516 var timelineData = TimelineModel.TimelineData.forEvent(event); | |
| 517 var backendNodeId = timelineData.backendNodeId; | |
| 518 if (!backendNodeId) | |
| 519 return; | |
| 520 new SDK.DeferredDOMNode(target, backendNodeId).highlight(); | |
| 521 } | |
| 522 | |
| 523 /** | |
| 524 * @override | |
| 525 * @param {number} entryIndex | |
| 526 * @return {string} | 507 * @return {string} |
| 527 */ | 508 */ |
| 528 entryColor(entryIndex) { | 509 entryColor(entryIndex) { |
| 529 // This is not annotated due to closure compiler failure to properly infer c
ache container's template type. | 510 // This is not annotated due to closure compiler failure to properly infer c
ache container's template type. |
| 530 function patchColorAndCache(cache, key, lookupColor) { | 511 function patchColorAndCache(cache, key, lookupColor) { |
| 531 var color = cache.get(key); | 512 var color = cache.get(key); |
| 532 if (color) | 513 if (color) |
| 533 return color; | 514 return color; |
| 534 var parsedColor = Common.Color.parse(lookupColor(key)); | 515 var parsedColor = Common.Color.parse(lookupColor(key)); |
| 535 color = parsedColor.setAlpha(0.7).asString(Common.Color.Format.RGBA) || ''
; | 516 color = parsedColor.setAlpha(0.7).asString(Common.Color.Format.RGBA) || ''
; |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 } | 857 } |
| 877 | 858 |
| 878 /** | 859 /** |
| 879 * @param {number} entryIndex | 860 * @param {number} entryIndex |
| 880 * @return {boolean} | 861 * @return {boolean} |
| 881 */ | 862 */ |
| 882 buildFlowForInitiator(entryIndex) { | 863 buildFlowForInitiator(entryIndex) { |
| 883 if (this._lastInitiatorEntry === entryIndex) | 864 if (this._lastInitiatorEntry === entryIndex) |
| 884 return false; | 865 return false; |
| 885 this._lastInitiatorEntry = entryIndex; | 866 this._lastInitiatorEntry = entryIndex; |
| 886 var event = this._entryType(entryIndex) === Timeline.TimelineFlameChartEntry
Type.Event ? | 867 var event = this.eventByIndex(entryIndex); |
| 887 /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryIndex]) : | |
| 888 null; | |
| 889 var td = this._timelineData; | |
| 890 var initiator = event && TimelineModel.TimelineData.forEvent(event).initiato
r(); | 868 var initiator = event && TimelineModel.TimelineData.forEvent(event).initiato
r(); |
| 891 if (initiator && !this._isVisible(initiator)) | 869 if (initiator && !this._isVisible(initiator)) |
| 892 initiator = null; | 870 initiator = null; |
| 871 var td = this._timelineData; |
| 893 if (td.flowStartTimes.length || initiator) { | 872 if (td.flowStartTimes.length || initiator) { |
| 894 td.flowStartTimes = []; | 873 td.flowStartTimes = []; |
| 895 td.flowStartLevels = []; | 874 td.flowStartLevels = []; |
| 896 td.flowEndTimes = []; | 875 td.flowEndTimes = []; |
| 897 td.flowEndLevels = []; | 876 td.flowEndLevels = []; |
| 898 } | 877 } |
| 899 if (!initiator) | 878 if (!initiator) |
| 900 return true; | 879 return true; |
| 901 var initiatorIndex = initiator[Timeline.TimelineFlameChartDataProvider._inde
xSymbol]; | 880 var initiatorIndex = initiator[Timeline.TimelineFlameChartDataProvider._inde
xSymbol]; |
| 902 var eventIndex = event[Timeline.TimelineFlameChartDataProvider._indexSymbol]
; | 881 var eventIndex = event[Timeline.TimelineFlameChartDataProvider._indexSymbol]
; |
| 903 td.flowStartTimes.push(initiator.endTime || initiator.startTime); | 882 td.flowStartTimes.push(initiator.endTime || initiator.startTime); |
| 904 td.flowStartLevels.push(td.entryLevels[initiatorIndex]); | 883 td.flowStartLevels.push(td.entryLevels[initiatorIndex]); |
| 905 td.flowEndTimes.push(event.startTime); | 884 td.flowEndTimes.push(event.startTime); |
| 906 td.flowEndLevels.push(td.entryLevels[eventIndex]); | 885 td.flowEndLevels.push(td.entryLevels[eventIndex]); |
| 907 return true; | 886 return true; |
| 908 } | 887 } |
| 888 |
| 889 /** |
| 890 * @param {number} entryIndex |
| 891 * @return {?SDK.TracingModel.Event} |
| 892 */ |
| 893 eventByIndex(entryIndex) { |
| 894 return this._entryType(entryIndex) === Timeline.TimelineFlameChartEntryType.
Event ? |
| 895 /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryIndex]) : |
| 896 null; |
| 897 } |
| 909 }; | 898 }; |
| 910 | 899 |
| 911 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; | 900 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; |
| 912 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index'); | 901 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index'); |
| OLD | NEW |