@lvce-editor/process-explorer-worker 3.22.0 → 3.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +41 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2068,7 +2068,7 @@ const dispose$3 = async () => {
|
|
|
2068
2068
|
await rpc?.dispose();
|
|
2069
2069
|
};
|
|
2070
2070
|
|
|
2071
|
-
const
|
|
2071
|
+
const ProcessExplorer$2 = {
|
|
2072
2072
|
__proto__: null,
|
|
2073
2073
|
clear: clear$1,
|
|
2074
2074
|
dispose: dispose$3,
|
|
@@ -2325,6 +2325,7 @@ const isDebuggable = command => {
|
|
|
2325
2325
|
|
|
2326
2326
|
const KillProcess = 'Kill Process';
|
|
2327
2327
|
const DebugProcess = 'Debug Process';
|
|
2328
|
+
const TakeHeapSnapshot = 'Take Heap Snapshot';
|
|
2328
2329
|
|
|
2329
2330
|
const getMenuEntries = state => {
|
|
2330
2331
|
const process = state.visibleProcesses[state.focusedIndex];
|
|
@@ -2346,6 +2347,13 @@ const getMenuEntries = state => {
|
|
|
2346
2347
|
id: 'debugProcess',
|
|
2347
2348
|
label: DebugProcess
|
|
2348
2349
|
});
|
|
2350
|
+
menuEntries.push({
|
|
2351
|
+
args: [state.focusedIndex],
|
|
2352
|
+
command: 'ProcessExplorer.takeHeapSnapshot',
|
|
2353
|
+
flags: None$1,
|
|
2354
|
+
id: 'takeHeapSnapshot',
|
|
2355
|
+
label: TakeHeapSnapshot
|
|
2356
|
+
});
|
|
2349
2357
|
}
|
|
2350
2358
|
return menuEntries;
|
|
2351
2359
|
};
|
|
@@ -2504,7 +2512,7 @@ const killProcess = async (state, index = state.focusedIndex) => {
|
|
|
2504
2512
|
if (!process || process.synthetic) {
|
|
2505
2513
|
return state;
|
|
2506
2514
|
}
|
|
2507
|
-
const processExplorer = process.source === 'remote' ? RemoteProcessExplorer :
|
|
2515
|
+
const processExplorer = process.source === 'remote' ? RemoteProcessExplorer : ProcessExplorer$2;
|
|
2508
2516
|
const killPromise = processExplorer.invoke('Process.kill', process.pid);
|
|
2509
2517
|
if (process.name === 'process-explorer') {
|
|
2510
2518
|
dispose$4(state.uid);
|
|
@@ -2701,9 +2709,9 @@ const refresh = async state => {
|
|
|
2701
2709
|
try {
|
|
2702
2710
|
await initializeProcessExplorer(state.platform);
|
|
2703
2711
|
const includeElectronData = state.platform === Electron;
|
|
2704
|
-
const rootPid = await getRootPid(
|
|
2712
|
+
const rootPid = await getRootPid(ProcessExplorer$2, state.rootPid, includeElectronData);
|
|
2705
2713
|
const pidMap = includeElectronData ? await invoke$5('CreatePidMap.createPidMap') : undefined;
|
|
2706
|
-
const processes = await listProcesses(
|
|
2714
|
+
const processes = await listProcesses(ProcessExplorer$2, rootPid, pidMap);
|
|
2707
2715
|
const frontendMemoryProcesses = state.includeFrontendMemoryUsage ? await getFrontendMemoryUsage(rootPid) : [];
|
|
2708
2716
|
const allProcesses = [...processes, ...frontendMemoryProcesses];
|
|
2709
2717
|
const localProcesses = state.platform === Electron ? reparentSharedProcessChildren(allProcesses) : allProcesses;
|
|
@@ -3146,8 +3154,18 @@ const getCellDom = (className, value, index, paddingLeft) => {
|
|
|
3146
3154
|
type: Td
|
|
3147
3155
|
}, text(value)];
|
|
3148
3156
|
};
|
|
3149
|
-
const
|
|
3150
|
-
|
|
3157
|
+
const getNameColumnWidth = visibleProcesses => {
|
|
3158
|
+
const hasWebContentsView = visibleProcesses.some(process => process.name.toLowerCase().includes('webcontentsview'));
|
|
3159
|
+
return hasWebContentsView ? '40%' : undefined;
|
|
3160
|
+
};
|
|
3161
|
+
const getHeaderDom = visibleProcesses => {
|
|
3162
|
+
const nameColumnWidth = getNameColumnWidth(visibleProcesses);
|
|
3163
|
+
return [tableHeadNode, headerRowNode, ...['Name', 'PID', 'Memory'].flatMap((label, index) => [{
|
|
3164
|
+
...headerCellNode,
|
|
3165
|
+
...(index === 0 && nameColumnWidth && {
|
|
3166
|
+
width: nameColumnWidth
|
|
3167
|
+
})
|
|
3168
|
+
}, text(label)])];
|
|
3151
3169
|
};
|
|
3152
3170
|
const getRowDom = (process, index, focused) => {
|
|
3153
3171
|
return [{
|
|
@@ -3229,7 +3247,7 @@ const getTableDom = state => {
|
|
|
3229
3247
|
role: Grid,
|
|
3230
3248
|
tabIndex: Focusable,
|
|
3231
3249
|
type: Table$1
|
|
3232
|
-
}, ...getHeaderDom(), ...getBodyDom(state)];
|
|
3250
|
+
}, ...getHeaderDom(visibleProcesses), ...getBodyDom(state)];
|
|
3233
3251
|
};
|
|
3234
3252
|
const getDom = state => {
|
|
3235
3253
|
const {
|
|
@@ -3386,6 +3404,21 @@ const setUpdateInterval = (state, updateInterval) => {
|
|
|
3386
3404
|
};
|
|
3387
3405
|
};
|
|
3388
3406
|
|
|
3407
|
+
const takeHeapSnapshot = async (state, index) => {
|
|
3408
|
+
const {
|
|
3409
|
+
focusedIndex,
|
|
3410
|
+
visibleProcesses
|
|
3411
|
+
} = state;
|
|
3412
|
+
const process = visibleProcesses[index ?? focusedIndex];
|
|
3413
|
+
if (!process || process.synthetic) {
|
|
3414
|
+
return state;
|
|
3415
|
+
}
|
|
3416
|
+
const processExplorer = process.source === 'remote' ? RemoteProcessExplorer : ProcessExplorer$2;
|
|
3417
|
+
const path = await processExplorer.invoke('Process.takeHeapSnapshot', process.pid, process.cmd);
|
|
3418
|
+
await invoke$3('Main.openUri', path);
|
|
3419
|
+
return state;
|
|
3420
|
+
};
|
|
3421
|
+
|
|
3389
3422
|
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
3390
3423
|
const commandMap = {
|
|
3391
3424
|
'ProcessExplorer.collapseAll': wrapCommand(collapseAll),
|
|
@@ -3421,6 +3454,7 @@ const commandMap = {
|
|
|
3421
3454
|
'ProcessExplorer.setError': wrapCommand(setError),
|
|
3422
3455
|
'ProcessExplorer.setRootProcessId': wrapCommand(setRootProcessId),
|
|
3423
3456
|
'ProcessExplorer.setUpdateInterval': wrapCommand(setUpdateInterval),
|
|
3457
|
+
'ProcessExplorer.takeHeapSnapshot': wrapCommand(takeHeapSnapshot),
|
|
3424
3458
|
'ProcessExplorer.terminate': terminate,
|
|
3425
3459
|
'ProcessExplorer.update': wrapCommand(refresh)
|
|
3426
3460
|
};
|