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

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

Issue 2797763003: DevTools: Show the full chain of initiators on the flame chart. (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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 buildFlowForInitiator(entryIndex) { 868 buildFlowForInitiator(entryIndex) {
869 if (this._lastInitiatorEntry === entryIndex) 869 if (this._lastInitiatorEntry === entryIndex)
870 return false; 870 return false;
871 this._lastInitiatorEntry = entryIndex; 871 this._lastInitiatorEntry = entryIndex;
872 var event = this.eventByIndex(entryIndex); 872 var event = this.eventByIndex(entryIndex);
873 var td = this._timelineData; 873 var td = this._timelineData;
874 td.flowStartTimes = []; 874 td.flowStartTimes = [];
875 td.flowStartLevels = []; 875 td.flowStartLevels = [];
876 td.flowEndTimes = []; 876 td.flowEndTimes = [];
877 td.flowEndLevels = []; 877 td.flowEndLevels = [];
878 // Find the closest ancestor with an initiator. 878 while (event) {
879 var initiator; 879 // Find the closest ancestor with an initiator.
880 for (; event; event = this._eventParent(event)) { 880 var initiator;
881 if (!this._isVisible(event)) 881 for (; event; event = this._eventParent(event)) {
882 continue; 882 if (!this._isVisible(event))
caseq 2017/04/04 18:07:28 do you still need this check?
883 initiator = TimelineModel.TimelineData.forEvent(event).initiator(); 883 continue;
884 if (initiator) 884 initiator = TimelineModel.TimelineData.forEvent(event).initiator();
885 break; 885 if (initiator)
886 break;
887 }
888 if (!initiator || !this._isVisible(initiator))
889 return true;
caseq 2017/04/04 18:07:28 nit: let's rather break from here.
890 var eventIndex = event[Timeline.TimelineFlameChartDataProvider._indexSymbo l];
891 var initiatorIndex = initiator[Timeline.TimelineFlameChartDataProvider._in dexSymbol];
892 td.flowStartTimes.push(initiator.endTime || initiator.startTime);
893 td.flowStartLevels.push(td.entryLevels[initiatorIndex]);
894 td.flowEndTimes.push(event.startTime);
895 td.flowEndLevels.push(td.entryLevels[eventIndex]);
896 event = initiator;
886 } 897 }
887 if (!initiator || !this._isVisible(initiator))
888 return true;
889 var eventIndex = event[Timeline.TimelineFlameChartDataProvider._indexSymbol] ;
890 var initiatorIndex = initiator[Timeline.TimelineFlameChartDataProvider._inde xSymbol];
891 td.flowStartTimes.push(initiator.endTime || initiator.startTime);
892 td.flowStartLevels.push(td.entryLevels[initiatorIndex]);
893 td.flowEndTimes.push(event.startTime);
894 td.flowEndLevels.push(td.entryLevels[eventIndex]);
895 return true; 898 return true;
896 } 899 }
897 900
898 /** 901 /**
899 * @param {!SDK.TracingModel.Event} event 902 * @param {!SDK.TracingModel.Event} event
900 * @return {?SDK.TracingModel.Event} 903 * @return {?SDK.TracingModel.Event}
901 */ 904 */
902 _eventParent(event) { 905 _eventParent(event) {
903 return this._entryParent[event[Timeline.TimelineFlameChartDataProvider._inde xSymbol]] || null; 906 return this._entryParent[event[Timeline.TimelineFlameChartDataProvider._inde xSymbol]] || null;
904 } 907 }
905 908
906 /** 909 /**
907 * @param {number} entryIndex 910 * @param {number} entryIndex
908 * @return {?SDK.TracingModel.Event} 911 * @return {?SDK.TracingModel.Event}
909 */ 912 */
910 eventByIndex(entryIndex) { 913 eventByIndex(entryIndex) {
911 return this._entryType(entryIndex) === Timeline.TimelineFlameChartEntryType. Event ? 914 return this._entryType(entryIndex) === Timeline.TimelineFlameChartEntryType. Event ?
912 /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryIndex]) : 915 /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryIndex]) :
913 null; 916 null;
914 } 917 }
915 }; 918 };
916 919
917 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; 920 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001;
918 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index'); 921 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index');
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698