From 8a374375ea2c0497b11e9979b0f136b77291a0c2 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Mon, 27 May 2019 15:13:14 +0200 Subject: [PATCH] remove IBroadcastService. Fixes #70831 --- .../workbench/browser/web.simpleservices.ts | 30 ----------- .../services/broadcast/common/broadcast.ts | 30 ----------- .../electron-browser/broadcastService.ts | 51 ------------------- src/vs/workbench/workbench.main.ts | 1 - src/vs/workbench/workbench.web.main.ts | 3 -- 5 files changed, 115 deletions(-) delete mode 100644 src/vs/workbench/services/broadcast/common/broadcast.ts delete mode 100644 src/vs/workbench/services/broadcast/electron-browser/broadcastService.ts diff --git a/src/vs/workbench/browser/web.simpleservices.ts b/src/vs/workbench/browser/web.simpleservices.ts index 350a893d7167d..3920c5d2d3163 100644 --- a/src/vs/workbench/browser/web.simpleservices.ts +++ b/src/vs/workbench/browser/web.simpleservices.ts @@ -144,36 +144,6 @@ registerSingleton(IBackupFileService, SimpleBackupFileService, true); //#endregion -//#region Broadcast - -export const IBroadcastService = createDecorator('broadcastService'); - -export interface IBroadcast { - channel: string; - payload: any; -} - -export interface IBroadcastService { - _serviceBrand: any; - - onBroadcast: Event; - - broadcast(b: IBroadcast): void; -} - -export class SimpleBroadcastService implements IBroadcastService { - - _serviceBrand: any; - - readonly onBroadcast: Event = Event.None; - - broadcast(b: IBroadcast): void { } -} - -registerSingleton(IBroadcastService, SimpleBroadcastService, true); - -//#endregion - //#region Clipboard export class SimpleClipboardService implements IClipboardService { diff --git a/src/vs/workbench/services/broadcast/common/broadcast.ts b/src/vs/workbench/services/broadcast/common/broadcast.ts deleted file mode 100644 index fc9e13031b696..0000000000000 --- a/src/vs/workbench/services/broadcast/common/broadcast.ts +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { Event } from 'vs/base/common/event'; - -export const IBroadcastService = createDecorator('broadcastService'); - -export interface IBroadcast { - channel: string; - payload: any; -} - -export interface IBroadcastService { - _serviceBrand: any; - - onBroadcast: Event; - - broadcast(b: IBroadcast): void; -} - -export class NullBroadcastService implements IBroadcastService { - _serviceBrand: any; - onBroadcast: Event = Event.None; - broadcast(_b: IBroadcast): void { - - } -} diff --git a/src/vs/workbench/services/broadcast/electron-browser/broadcastService.ts b/src/vs/workbench/services/broadcast/electron-browser/broadcastService.ts deleted file mode 100644 index c4a5f3d79f7d8..0000000000000 --- a/src/vs/workbench/services/broadcast/electron-browser/broadcastService.ts +++ /dev/null @@ -1,51 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { Event, Emitter } from 'vs/base/common/event'; -import { ipcRenderer as ipc } from 'electron'; -import { ILogService } from 'vs/platform/log/common/log'; -import { Disposable } from 'vs/base/common/lifecycle'; -import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { IWindowService } from 'vs/platform/windows/common/windows'; -import { IBroadcastService, IBroadcast } from 'vs/workbench/services/broadcast/common/broadcast'; - -class BroadcastService extends Disposable implements IBroadcastService { - _serviceBrand: any; - - private readonly _onBroadcast: Emitter = this._register(new Emitter()); - get onBroadcast(): Event { return this._onBroadcast.event; } - - private windowId: number; - - constructor( - @IWindowService readonly windowService: IWindowService, - @ILogService private readonly logService: ILogService - ) { - super(); - - this.windowId = windowService.windowId; - - this.registerListeners(); - } - - private registerListeners(): void { - ipc.on('vscode:broadcast', (event: unknown, b: IBroadcast) => { - this.logService.trace(`Received broadcast from main in window ${this.windowId}: `, b); - - this._onBroadcast.fire(b); - }); - } - - broadcast(b: IBroadcast): void { - this.logService.trace(`Sending broadcast to main from window ${this.windowId}: `, b); - - ipc.send('vscode:broadcast', this.windowId, { - channel: b.channel, - payload: b.payload - }); - } -} - -registerSingleton(IBroadcastService, BroadcastService, true); diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index 3b71d71b1fdd8..78cc5e9594298 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -104,7 +104,6 @@ import 'vs/workbench/services/decorations/browser/decorationsService'; import 'vs/workbench/services/search/node/searchService'; import 'vs/workbench/services/progress/browser/progressService'; import 'vs/workbench/services/editor/browser/codeEditorService'; -import 'vs/workbench/services/broadcast/electron-browser/broadcastService'; import 'vs/workbench/services/extensions/electron-browser/extensionHostDebugService'; import 'vs/workbench/services/preferences/browser/preferencesService'; import 'vs/workbench/services/output/node/outputChannelModelService'; diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts index 08bd32f044fcf..147c0818ae436 100644 --- a/src/vs/workbench/workbench.web.main.ts +++ b/src/vs/workbench/workbench.web.main.ts @@ -90,7 +90,6 @@ import { ContextViewService } from 'vs/platform/contextview/browser/contextViewS // import { IURLService } from 'vs/platform/url/common/url'; // import { RelayURLService } from 'vs/platform/url/electron-browser/urlService'; import { IHeapService, NullHeapService } from 'vs/workbench/services/heap/common/heap'; -import { IBroadcastService, NullBroadcastService } from 'vs/workbench/services/broadcast/common/broadcast'; import { ConfigurationResolverService } from 'vs/workbench/services/configurationResolver/browser/configurationResolverService'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; @@ -108,7 +107,6 @@ import 'vs/workbench/services/decorations/browser/decorationsService'; // import 'vs/workbench/services/search/node/searchService'; import 'vs/workbench/services/progress/browser/progressService'; import 'vs/workbench/services/editor/browser/codeEditorService'; -// import 'vs/workbench/services/broadcast/electron-browser/broadcastService'; import 'vs/workbench/services/preferences/browser/preferencesService'; import 'vs/workbench/services/output/common/outputChannelModelService'; import 'vs/workbench/services/configuration/common/jsonEditingService'; @@ -166,7 +164,6 @@ registerSingleton(IContextViewService, ContextViewService, true); // registerSingleton(IMenubarService, MenubarService); // registerSingleton(IURLService, RelayURLService); registerSingleton(IHeapService, NullHeapService); -registerSingleton(IBroadcastService, NullBroadcastService); registerSingleton(IContextMenuService, ContextMenuService); registerSingleton(IConfigurationResolverService, ConfigurationResolverService, true);