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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 * @param {!SDK.TracingModel.Event} event | 702 * @param {!SDK.TracingModel.Event} event |
703 * @param {number} level | 703 * @param {number} level |
704 */ | 704 */ |
705 _appendEvent(event, level) { | 705 _appendEvent(event, level) { |
706 var index = this._entryData.length; | 706 var index = this._entryData.length; |
707 this._entryData.push(event); | 707 this._entryData.push(event); |
708 this._timelineData.entryLevels[index] = level; | 708 this._timelineData.entryLevels[index] = level; |
709 this._timelineData.entryTotalTimes[index] = | 709 this._timelineData.entryTotalTimes[index] = |
710 event.duration || Timeline.TimelineFlameChartDataProvider.InstantEventVi
sibleDurationMs; | 710 event.duration || Timeline.TimelineFlameChartDataProvider.InstantEventVi
sibleDurationMs; |
711 this._timelineData.entryStartTimes[index] = event.startTime; | 711 this._timelineData.entryStartTimes[index] = event.startTime; |
| 712 event[Timeline.TimelineFlameChartDataProvider._indexSymbol] = index; |
712 } | 713 } |
713 | 714 |
714 /** | 715 /** |
715 * @param {!SDK.TracingModel.AsyncEvent} asyncEvent | 716 * @param {!SDK.TracingModel.AsyncEvent} asyncEvent |
716 * @param {number} level | 717 * @param {number} level |
717 */ | 718 */ |
718 _appendAsyncEvent(asyncEvent, level) { | 719 _appendAsyncEvent(asyncEvent, level) { |
719 if (SDK.TracingModel.isNestableAsyncPhase(asyncEvent.phase)) { | 720 if (SDK.TracingModel.isNestableAsyncPhase(asyncEvent.phase)) { |
720 // FIXME: also add steps once we support event nesting in the FlameChart. | 721 // FIXME: also add steps once we support event nesting in the FlameChart. |
721 this._appendEvent(asyncEvent, level); | 722 this._appendEvent(asyncEvent, level); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 | 867 |
867 /** | 868 /** |
868 * @param {!SDK.TracingModel.Event} event | 869 * @param {!SDK.TracingModel.Event} event |
869 * @return {boolean} | 870 * @return {boolean} |
870 */ | 871 */ |
871 _isVisible(event) { | 872 _isVisible(event) { |
872 return this._filters.every(function(filter) { | 873 return this._filters.every(function(filter) { |
873 return filter.accept(event); | 874 return filter.accept(event); |
874 }); | 875 }); |
875 } | 876 } |
| 877 |
| 878 /** |
| 879 * @param {number} entryIndex |
| 880 * @return {boolean} |
| 881 */ |
| 882 buildFlowForInitiator(entryIndex) { |
| 883 if (this._lastInitiatorEntry === entryIndex) |
| 884 return false; |
| 885 this._lastInitiatorEntry = entryIndex; |
| 886 var event = this._entryType(entryIndex) === Timeline.TimelineFlameChartEntry
Type.Event ? |
| 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(); |
| 891 if (initiator && !this._isVisible(initiator)) |
| 892 initiator = null; |
| 893 if (td.flowStartTimes.length || initiator) { |
| 894 td.flowStartTimes = []; |
| 895 td.flowStartLevels = []; |
| 896 td.flowEndTimes = []; |
| 897 td.flowEndLevels = []; |
| 898 } |
| 899 if (!initiator) |
| 900 return true; |
| 901 var initiatorIndex = initiator[Timeline.TimelineFlameChartDataProvider._inde
xSymbol]; |
| 902 var eventIndex = event[Timeline.TimelineFlameChartDataProvider._indexSymbol]
; |
| 903 td.flowStartTimes.push(initiator.endTime || initiator.startTime); |
| 904 td.flowStartLevels.push(td.entryLevels[initiatorIndex]); |
| 905 td.flowEndTimes.push(event.startTime); |
| 906 td.flowEndLevels.push(td.entryLevels[eventIndex]); |
| 907 return true; |
| 908 } |
876 }; | 909 }; |
877 | 910 |
878 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; | 911 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; |
| 912 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index'); |
OLD | NEW |