Skip to content

Commit b42888f

Browse files
committed
Add getProfileFlowInfo selector.
1 parent a5b7c6c commit b42888f

File tree

5 files changed

+706
-0
lines changed

5 files changed

+706
-0
lines changed

src/actions/profile-view.js

+47
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,53 @@ export function showProvidedTracks(
999999
};
10001000
}
10011001

1002+
export function showProvidedThreads(
1003+
threadsToShow: Set<ThreadIndex>
1004+
): ThunkAction<void> {
1005+
return (dispatch, getState) => {
1006+
const globalTracks = getGlobalTracks(getState());
1007+
const localTracksByPid = getLocalTracksByPid(getState());
1008+
1009+
const globalTracksToShow: Set<TrackIndex> = new Set();
1010+
const localTracksByPidToShow: Map<Pid, Set<TrackIndex>> = new Map();
1011+
1012+
for (const [globalTrackIndex, globalTrack] of globalTracks.entries()) {
1013+
if (globalTrack.type !== 'process') {
1014+
continue;
1015+
}
1016+
const { mainThreadIndex, pid } = globalTrack;
1017+
if (mainThreadIndex !== null && threadsToShow.has(mainThreadIndex)) {
1018+
globalTracksToShow.add(globalTrackIndex);
1019+
}
1020+
const localTracks = localTracksByPid.get(pid);
1021+
if (localTracks === undefined) {
1022+
continue;
1023+
}
1024+
1025+
for (const [localTrackIndex, localTrack] of localTracks.entries()) {
1026+
if (localTrack.type !== 'thread') {
1027+
continue;
1028+
}
1029+
if (threadsToShow.has(localTrack.threadIndex)) {
1030+
const localTracksToShow = localTracksByPidToShow.get(pid);
1031+
if (localTracksToShow === undefined) {
1032+
localTracksByPidToShow.set(pid, new Set([localTrackIndex]));
1033+
} else {
1034+
localTracksToShow.add(localTrackIndex);
1035+
}
1036+
globalTracksToShow.add(globalTrackIndex);
1037+
}
1038+
}
1039+
}
1040+
1041+
dispatch({
1042+
type: 'SHOW_PROVIDED_TRACKS',
1043+
globalTracksToShow,
1044+
localTracksByPidToShow,
1045+
});
1046+
};
1047+
}
1048+
10021049
/**
10031050
* This action makes the tracks that are provided hidden.
10041051
*/

0 commit comments

Comments
 (0)