Path: blob/main/src/vs/platform/ipc/common/mainProcessService.ts
3294 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 { IChannel, IPCServer, IServerChannel, StaticRouter } from '../../../base/parts/ipc/common/ipc.js';6import { createDecorator } from '../../instantiation/common/instantiation.js';7import { IRemoteService } from './services.js';89export const IMainProcessService = createDecorator<IMainProcessService>('mainProcessService');1011export interface IMainProcessService extends IRemoteService { }1213/**14* An implementation of `IMainProcessService` that leverages `IPCServer`.15*/16export class MainProcessService implements IMainProcessService {1718declare readonly _serviceBrand: undefined;1920constructor(21private server: IPCServer,22private router: StaticRouter23) { }2425getChannel(channelName: string): IChannel {26return this.server.getChannel(channelName, this.router);27}2829registerChannel(channelName: string, channel: IServerChannel<string>): void {30this.server.registerChannel(channelName, channel);31}32}333435