Path: blob/main/src/vs/workbench/services/browserView/electron-browser/playwrightWorkbenchService.ts
13401 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { mainWindow } from '../../../../base/browser/window.js';6import { IChannel, ProxyChannel } from '../../../../base/parts/ipc/common/ipc.js';7import { IPlaywrightService } from '../../../../platform/browserView/common/playwrightService.js';8import { registerSharedProcessRemoteService } from '../../../../platform/ipc/electron-browser/services.js';9import { ILogService } from '../../../../platform/log/common/log.js';1011class PlaywrightChannelClient {12constructor(13channel: IChannel,14@ILogService logService: ILogService15) {16/**17* send the current window's ID once via `__initialize`, so the server-side {@link PlaywrightChannel}18* can create a per-window {@link PlaywrightWindowInstance}. All subsequent calls and events are proxied directly.19*/20void channel.call('__initialize', mainWindow.vscodeWindowId).catch((e) => {21logService.error(`Failed to initialize Playwright service`, e);22});23return ProxyChannel.toService<IPlaywrightService>(channel);24}25}2627registerSharedProcessRemoteService(IPlaywrightService, 'playwright', { channelClientCtor: PlaywrightChannelClient });282930