Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(909)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartDataProvider.js

Issue 2779253003: DevTools: Show top level event initiator when a child is selected. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 858
859 /** 859 /**
860 * @param {number} entryIndex 860 * @param {number} entryIndex
861 * @return {boolean} 861 * @return {boolean}
862 */ 862 */
863 buildFlowForInitiator(entryIndex) { 863 buildFlowForInitiator(entryIndex) {
864 if (this._lastInitiatorEntry === entryIndex) 864 if (this._lastInitiatorEntry === entryIndex)
865 return false; 865 return false;
866 this._lastInitiatorEntry = entryIndex; 866 this._lastInitiatorEntry = entryIndex;
867 var event = this.eventByIndex(entryIndex); 867 var event = this.eventByIndex(entryIndex);
868 var initiator = event && TimelineModel.TimelineData.forEvent(event).initiato r();
869 if (initiator && !this._isVisible(initiator))
870 initiator = null;
871 var td = this._timelineData; 868 var td = this._timelineData;
872 if (td.flowStartTimes.length || initiator) { 869 td.flowStartTimes = [];
873 td.flowStartTimes = []; 870 td.flowStartLevels = [];
874 td.flowStartLevels = []; 871 td.flowEndTimes = [];
875 td.flowEndTimes = []; 872 td.flowEndLevels = [];
876 td.flowEndLevels = []; 873 // Find the closest ancestor with an initiator.
874 var initiator;
875 for (; event; event = TimelineModel.TimelineModel.parentEvent(event)) {
876 if (!this._isVisible(event))
877 continue;
878 initiator = TimelineModel.TimelineData.forEvent(event).initiator();
879 if (initiator)
880 break;
877 } 881 }
878 if (!initiator) 882 if (!event || !initiator || !this._isVisible(initiator))
caseq 2017/03/29 22:08:20 nit: first clause is redundant
alph 2017/03/29 22:16:57 Done.
879 return true; 883 return true;
884 var eventIndex = event[Timeline.TimelineFlameChartDataProvider._indexSymbol] ;
880 var initiatorIndex = initiator[Timeline.TimelineFlameChartDataProvider._inde xSymbol]; 885 var initiatorIndex = initiator[Timeline.TimelineFlameChartDataProvider._inde xSymbol];
881 var eventIndex = event[Timeline.TimelineFlameChartDataProvider._indexSymbol] ;
882 td.flowStartTimes.push(initiator.endTime || initiator.startTime); 886 td.flowStartTimes.push(initiator.endTime || initiator.startTime);
883 td.flowStartLevels.push(td.entryLevels[initiatorIndex]); 887 td.flowStartLevels.push(td.entryLevels[initiatorIndex]);
884 td.flowEndTimes.push(event.startTime); 888 td.flowEndTimes.push(event.startTime);
885 td.flowEndLevels.push(td.entryLevels[eventIndex]); 889 td.flowEndLevels.push(td.entryLevels[eventIndex]);
886 return true; 890 return true;
887 } 891 }
888 892
889 /** 893 /**
890 * @param {number} entryIndex 894 * @param {number} entryIndex
891 * @return {?SDK.TracingModel.Event} 895 * @return {?SDK.TracingModel.Event}
892 */ 896 */
893 eventByIndex(entryIndex) { 897 eventByIndex(entryIndex) {
894 return this._entryType(entryIndex) === Timeline.TimelineFlameChartEntryType. Event ? 898 return this._entryType(entryIndex) === Timeline.TimelineFlameChartEntryType. Event ?
895 /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryIndex]) : 899 /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryIndex]) :
896 null; 900 null;
897 } 901 }
898 }; 902 };
899 903
900 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; 904 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001;
901 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index'); 905 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698