diff --git a/src/vs/base/common/remote.ts b/src/vs/base/common/remote.ts index b6a8d2d17ac..a605a56dade 100644 --- a/src/vs/base/common/remote.ts +++ b/src/vs/base/common/remote.ts @@ -15,23 +15,5 @@ export interface IProxyHelper { } export interface IRemoteCom extends IProxyHelper { - registerBigHandler(handler:IManyHandler): void; -} - -export function createProxyFromCtor(remote:IProxyHelper, id:string, ctor:Function): any { - var result: any = { - $__IS_REMOTE_OBJ: true - }; - for (var prop in ctor.prototype) { - if (typeof ctor.prototype[prop] === 'function') { - result[prop] = createMethodProxy(remote, id, prop); - } - } - return result; -} - -function createMethodProxy(remote:IProxyHelper, proxyId: string, path: string): (...myArgs: any[]) => TPromise { - return (...myArgs: any[]) => { - return remote.callOnRemote(proxyId, path, myArgs); - }; + setManyHandler(handler:IManyHandler): void; } diff --git a/src/vs/base/common/worker/workerProtocol.ts b/src/vs/base/common/worker/workerProtocol.ts index 0c07ce34223..9b339b9a47d 100644 --- a/src/vs/base/common/worker/workerProtocol.ts +++ b/src/vs/base/common/worker/workerProtocol.ts @@ -93,7 +93,7 @@ export class RemoteCom implements remote.IRemoteCom { }); } - public registerBigHandler(handler:remote.IManyHandler): void { + public setManyHandler(handler:remote.IManyHandler): void { this._bigHandler = handler; } diff --git a/src/vs/platform/plugins/common/ipcRemoteCom.ts b/src/vs/platform/plugins/common/ipcRemoteCom.ts index c6fc485d706..f10a08f0793 100644 --- a/src/vs/platform/plugins/common/ipcRemoteCom.ts +++ b/src/vs/platform/plugins/common/ipcRemoteCom.ts @@ -136,7 +136,7 @@ export function create(send: (obj: string[]) => void): IPluginsIPC { let r: IPluginsIPC = { callOnRemote: rpc, - registerBigHandler: (_bigHandler: remote.IManyHandler): void => { + setManyHandler: (_bigHandler: remote.IManyHandler): void => { bigHandler = _bigHandler; }, handle: (rawmsg) => { diff --git a/src/vs/platform/thread/common/abstractThreadService.ts b/src/vs/platform/thread/common/abstractThreadService.ts index 08231de3b02..1e7d0a0feba 100644 --- a/src/vs/platform/thread/common/abstractThreadService.ts +++ b/src/vs/platform/thread/common/abstractThreadService.ts @@ -139,7 +139,7 @@ export abstract class AbstractThreadService implements remote.IManyHandler { if (this._proxyObjMap[id]) { return this._proxyObjMap[id]; } - let result = remote.createProxyFromCtor(remoteCom, id, descriptor.ctor); + let result = createProxyFromCtor(remoteCom, id, descriptor.ctor); this._proxyObjMap[id] = result; return result; } @@ -207,4 +207,22 @@ export abstract class AbstractThreadService implements remote.IManyHandler { protected abstract _registerPluginHostActor(id: string, actor: T): void; protected abstract _registerAndInstantiateWorkerActor(id: string, descriptor: SyncDescriptor0, whichWorker: ThreadAffinity): T; protected abstract _registerWorkerActor(id: string, actor: T): void; -} \ No newline at end of file +} + +function createProxyFromCtor(remote:remote.IProxyHelper, id:string, ctor:Function): any { + var result: any = { + $__IS_REMOTE_OBJ: true + }; + for (var prop in ctor.prototype) { + if (typeof ctor.prototype[prop] === 'function') { + result[prop] = createMethodProxy(remote, id, prop); + } + } + return result; +} + +function createMethodProxy(remote:remote.IProxyHelper, proxyId: string, path: string): (...myArgs: any[]) => TPromise { + return (...myArgs: any[]) => { + return remote.callOnRemote(proxyId, path, myArgs); + }; +} diff --git a/src/vs/platform/thread/common/mainThreadService.ts b/src/vs/platform/thread/common/mainThreadService.ts index 43d9a9fd315..c313b83556b 100644 --- a/src/vs/platform/thread/common/mainThreadService.ts +++ b/src/vs/platform/thread/common/mainThreadService.ts @@ -164,7 +164,7 @@ export class MainThreadService extends abstractThreadService.AbstractThreadServi }, workerId ); - worker.getRemoteCom().registerBigHandler(this); + worker.getRemoteCom().setManyHandler(this); worker.onModuleLoaded = worker.request('initialize', { threadService: this._getRegisteredObjectsData(), contextService: { diff --git a/src/vs/platform/thread/common/pluginHostThreadService.ts b/src/vs/platform/thread/common/pluginHostThreadService.ts index a99e9ae877d..269d2a12cdf 100644 --- a/src/vs/platform/thread/common/pluginHostThreadService.ts +++ b/src/vs/platform/thread/common/pluginHostThreadService.ts @@ -19,7 +19,7 @@ export class PluginHostThreadService extends abstractThreadService.AbstractThrea constructor(remoteCom: remote.IRemoteCom) { super(false); this._remoteCom = remoteCom; - this._remoteCom.registerBigHandler(this); + this._remoteCom.setManyHandler(this); // Register all statically instantiated synchronizable objects readThreadSynchronizableObjects().forEach((obj) => this.registerInstance(obj)); diff --git a/src/vs/platform/thread/common/workerThreadService.ts b/src/vs/platform/thread/common/workerThreadService.ts index 874bd20dd05..9392b5e5284 100644 --- a/src/vs/platform/thread/common/workerThreadService.ts +++ b/src/vs/platform/thread/common/workerThreadService.ts @@ -25,7 +25,7 @@ export class WorkerThreadService extends abstractThreadService.AbstractThreadSer super(false); this._mainThreadData = mainThreadData; this._remoteCom = remoteCom; - this._remoteCom.registerBigHandler(this); + this._remoteCom.setManyHandler(this); this._publisher = workerPublisher; diff --git a/src/vs/workbench/services/thread/electron-browser/threadService.ts b/src/vs/workbench/services/thread/electron-browser/threadService.ts index ecaf99b2003..c4204c77941 100644 --- a/src/vs/workbench/services/thread/electron-browser/threadService.ts +++ b/src/vs/workbench/services/thread/electron-browser/threadService.ts @@ -65,7 +65,7 @@ export class MainThreadService extends CommonMainThreadService { this.remoteCom.handle(msg); }); - this.remoteCom.registerBigHandler(this); + this.remoteCom.setManyHandler(this); } public dispose(): void {