mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 09:35:40 -05:00
Merge from vscode 79a1f5a5ca0c6c53db617aa1fa5a2396d2caebe2
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Client } from 'vs/base/parts/ipc/electron-browser/ipc.electron-browser';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export const IMainProcessService = createDecorator<IMainProcessService>('mainProcessService');
|
||||
|
||||
export interface IMainProcessService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
getChannel(channelName: string): IChannel;
|
||||
|
||||
registerChannel(channelName: string, channel: IServerChannel<string>): void;
|
||||
}
|
||||
|
||||
export class MainProcessService extends Disposable implements IMainProcessService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private mainProcessConnection: Client;
|
||||
|
||||
constructor(
|
||||
windowId: number
|
||||
) {
|
||||
super();
|
||||
|
||||
this.mainProcessConnection = this._register(new Client(`window:${windowId}`));
|
||||
}
|
||||
|
||||
getChannel(channelName: string): IChannel {
|
||||
return this.mainProcessConnection.getChannel(channelName);
|
||||
}
|
||||
|
||||
registerChannel(channelName: string, channel: IServerChannel<string>): void {
|
||||
this.mainProcessConnection.registerChannel(channelName, channel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user