src/vs/platform/sharedProcess/electron-main/sharedProcess.ts/SharedProcess/onWorkerConnection
class SharedProcess:	private onWorkerConnection(e: IpcMainEvent, configuration: ISharedProcessWorkerConfiguration): void {
		this.logService.trace('SharedProcess: onWorkerConnection', configuration);

		const disposables = new DisposableStore();

		const disposeWorker = (reason: string) => {
			if (!this.isAlive()) {
				return; // the shared process is already gone, no need to dispose anything
			}

			this.logService.trace(`SharedProcess: disposing worker (reason: '${reason}')`, configuration);

			// Only once!
			disposables.dispose();

			// Send this into the shared process who owns workers
			this.send('vscode:electron-main->shared-process=disposeWorker', configuration);
		};

		// Ensure the sender is a valid target to send to
		const receiverWindow = BrowserWindow.fromId(configuration.reply.windowId);
		if (!receiverWindow || receiverWindow.isDestroyed() || receiverWindow.webContents.isDestroyed() || !configuration.reply.channel) {
			disposeWorker('unavailable');

			return;
		}

		// Attach to lifecycle of receiver to manage worker lifecycle
		disposables.add(Event.filter(this.lifecycleMainService.onWillLoadWindow, e => e.window.win === receiverWindow)(() => disposeWorker('load')));
		disposables.add(Event.fromNodeEventEmitter(receiverWindow, 'closed')(() => disposeWorker('closed')));

		// The shared process window asks us to relay a `MessagePort`
		// from a shared process worker to the target window. It needs
		// to be send via `postMessage` to transfer the port.
		receiverWindow.webContents.postMessage(configuration.reply.channel, configuration.reply.nonce, e.ports);
	}