MCPcopy Index your code
hub / github.com/CapSoftware/Cap / classifyProcess

Function classifyProcess

apps/desktop/scripts/desktop-memory-soak-lib.js:92–135  ·  view source on GitHub ↗
(
	command,
	appCommandPrefix = DEFAULTS.appCommandPrefix,
)

Source from the content-addressed store, hash-verified

90}
91
92export function classifyProcess(
93 command,
94 appCommandPrefix = DEFAULTS.appCommandPrefix,
95) {
96 if (
97 command.startsWith(
98 "/System/Library/PrivateFrameworks/SkyLight.framework/Resources/WindowServer",
99 )
100 ) {
101 return {
102 group: "system",
103 kind: "window-server",
104 label: "windowserver",
105 };
106 }
107
108 if (command === appCommandPrefix) {
109 return { group: "cap", kind: "cap-main", label: "cap-main" };
110 }
111
112 if (command.startsWith(`${appCommandPrefix} --crash-reporter-server=`)) {
113 return { group: "cap", kind: "cap-crash", label: "cap-crash" };
114 }
115
116 if (command.includes("com.apple.WebKit.GPU.xpc")) {
117 return { group: "cap", kind: "webkit-gpu", label: "wk-gpu" };
118 }
119
120 if (command.includes("com.apple.WebKit.Networking.xpc")) {
121 return { group: "cap", kind: "webkit-networking", label: "wk-net" };
122 }
123
124 if (command.includes("com.apple.WebKit.WebContent.xpc")) {
125 return { group: "cap", kind: "webkit-webcontent", label: "wk-webcontent" };
126 }
127
128 for (const [label, pattern] of MEDIA_PROCESS_PATTERNS) {
129 if (pattern.test(command)) {
130 return { group: "media", kind: label, label };
131 }
132 }
133
134 return null;
135}
136
137export function findCapMainProcess(
138 processes,

Callers 2

discoverTrackedProcessesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected