Skip to content

Commit

Permalink
Add getProfileFlowInfo selector.
Browse files Browse the repository at this point in the history
  • Loading branch information
mstange committed Nov 7, 2024
1 parent a5b7c6c commit b42888f
Show file tree
Hide file tree
Showing 5 changed files with 706 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/actions/profile-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,53 @@ export function showProvidedTracks(
};
}

export function showProvidedThreads(
threadsToShow: Set<ThreadIndex>
): ThunkAction<void> {
return (dispatch, getState) => {
const globalTracks = getGlobalTracks(getState());
const localTracksByPid = getLocalTracksByPid(getState());

Check warning on line 1007 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1004-L1007

Added lines #L1004 - L1007 were not covered by tests

const globalTracksToShow: Set<TrackIndex> = new Set();
const localTracksByPidToShow: Map<Pid, Set<TrackIndex>> = new Map();

Check warning on line 1010 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1009-L1010

Added lines #L1009 - L1010 were not covered by tests

for (const [globalTrackIndex, globalTrack] of globalTracks.entries()) {

Check warning on line 1012 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1012

Added line #L1012 was not covered by tests
if (globalTrack.type !== 'process') {
continue;

Check warning on line 1014 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1014

Added line #L1014 was not covered by tests
}
const { mainThreadIndex, pid } = globalTrack;

Check warning on line 1016 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1016

Added line #L1016 was not covered by tests
if (mainThreadIndex !== null && threadsToShow.has(mainThreadIndex)) {
globalTracksToShow.add(globalTrackIndex);

Check warning on line 1018 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1018

Added line #L1018 was not covered by tests
}
const localTracks = localTracksByPid.get(pid);

Check warning on line 1020 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1020

Added line #L1020 was not covered by tests
if (localTracks === undefined) {
continue;

Check warning on line 1022 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1022

Added line #L1022 was not covered by tests
}

for (const [localTrackIndex, localTrack] of localTracks.entries()) {

Check warning on line 1025 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1025

Added line #L1025 was not covered by tests
if (localTrack.type !== 'thread') {
continue;

Check warning on line 1027 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1027

Added line #L1027 was not covered by tests
}
if (threadsToShow.has(localTrack.threadIndex)) {
const localTracksToShow = localTracksByPidToShow.get(pid);

Check warning on line 1030 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1030

Added line #L1030 was not covered by tests
if (localTracksToShow === undefined) {
localTracksByPidToShow.set(pid, new Set([localTrackIndex]));
} else {
localTracksToShow.add(localTrackIndex);

Check warning on line 1034 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1032-L1034

Added lines #L1032 - L1034 were not covered by tests
}
globalTracksToShow.add(globalTrackIndex);

Check warning on line 1036 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1036

Added line #L1036 was not covered by tests
}
}
}

dispatch({

Check warning on line 1041 in src/actions/profile-view.js

View check run for this annotation

Codecov / codecov/patch

src/actions/profile-view.js#L1041

Added line #L1041 was not covered by tests
type: 'SHOW_PROVIDED_TRACKS',
globalTracksToShow,
localTracksByPidToShow,
});
};
}

/**
* This action makes the tracks that are provided hidden.
*/
Expand Down
Loading

0 comments on commit b42888f

Please sign in to comment.