@lvce-editor/process-explorer-worker 3.22.1 → 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 +28 -4
- 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;
|
|
@@ -3396,6 +3404,21 @@ const setUpdateInterval = (state, updateInterval) => {
|
|
|
3396
3404
|
};
|
|
3397
3405
|
};
|
|
3398
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
|
+
|
|
3399
3422
|
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
3400
3423
|
const commandMap = {
|
|
3401
3424
|
'ProcessExplorer.collapseAll': wrapCommand(collapseAll),
|
|
@@ -3431,6 +3454,7 @@ const commandMap = {
|
|
|
3431
3454
|
'ProcessExplorer.setError': wrapCommand(setError),
|
|
3432
3455
|
'ProcessExplorer.setRootProcessId': wrapCommand(setRootProcessId),
|
|
3433
3456
|
'ProcessExplorer.setUpdateInterval': wrapCommand(setUpdateInterval),
|
|
3457
|
+
'ProcessExplorer.takeHeapSnapshot': wrapCommand(takeHeapSnapshot),
|
|
3434
3458
|
'ProcessExplorer.terminate': terminate,
|
|
3435
3459
|
'ProcessExplorer.update': wrapCommand(refresh)
|
|
3436
3460
|
};
|