提交 e02a1c35 编写于 作者: B Benjamin Pasero

perf - pass over window ID instead of accessing via remote call on startup

上级 0ec4814c
......@@ -563,6 +563,9 @@ export class CodeWindow implements ICodeWindow {
private getUrl(windowConfiguration: IWindowConfiguration): string {
// Set window ID
windowConfiguration.windowId = this._win.id;
// Set zoomlevel
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
const zoomLevel = windowConfig && windowConfig.zoomLevel;
......
......@@ -292,6 +292,7 @@ export interface IAddFoldersRequest {
export interface IWindowConfiguration extends ParsedArgs, IOpenFileRequest {
machineId: string;
windowId: number;
appRoot: string;
execPath: string;
......
......@@ -32,7 +32,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { StorageService, inMemoryLocalStorageInstance } from 'vs/platform/storage/common/storageService';
import { Client as ElectronIPCClient } from 'vs/base/parts/ipc/electron-browser/ipc.electron-browser';
import { webFrame, remote } from 'electron';
import { webFrame } from 'electron';
import { UpdateChannelClient } from 'vs/platform/update/common/updateIpc';
import { IUpdateService } from 'vs/platform/update/common/update';
import { URLChannelClient } from 'vs/platform/url/common/urlIpc';
......@@ -45,8 +45,6 @@ import fs = require('fs');
import { ConsoleLogService, MultiplexLogService } from 'vs/platform/log/common/log';
gracefulFs.gracefulify(fs); // enable gracefulFs
const currentWindowId = remote.getCurrentWindow().id;
export function startup(configuration: IWindowConfiguration): TPromise<void> {
// Ensure others can listen to zoom level changes
......@@ -70,11 +68,11 @@ export function startup(configuration: IWindowConfiguration): TPromise<void> {
}
function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
const mainProcessClient = new ElectronIPCClient(String(`window${currentWindowId}`));
const mainServices = createMainProcessServices(mainProcessClient);
const mainProcessClient = new ElectronIPCClient(String(`window${configuration.windowId}`));
const mainServices = createMainProcessServices(mainProcessClient, configuration);
const environmentService = new EnvironmentService(configuration, configuration.execPath);
const spdlogService = createLogService(`renderer${currentWindowId}`, environmentService);
const spdlogService = createLogService(`renderer${configuration.windowId}`, environmentService);
const consoleLogService = new ConsoleLogService(environmentService);
const logService = new MultiplexLogService([consoleLogService, spdlogService]);
......@@ -194,7 +192,7 @@ function createStorageService(workspaceService: IWorkspaceContextService, enviro
return new StorageService(storage, storage, workspaceId, secondaryWorkspaceId);
}
function createMainProcessServices(mainProcessClient: ElectronIPCClient): ServiceCollection {
function createMainProcessServices(mainProcessClient: ElectronIPCClient, configuration: IWindowConfiguration): ServiceCollection {
const serviceCollection = new ServiceCollection();
const windowsChannel = mainProcessClient.getChannel('windows');
......@@ -204,7 +202,7 @@ function createMainProcessServices(mainProcessClient: ElectronIPCClient): Servic
serviceCollection.set(IUpdateService, new SyncDescriptor(UpdateChannelClient, updateChannel));
const urlChannel = mainProcessClient.getChannel('url');
serviceCollection.set(IURLService, new SyncDescriptor(URLChannelClient, urlChannel, currentWindowId));
serviceCollection.set(IURLService, new SyncDescriptor(URLChannelClient, urlChannel, configuration.windowId));
const workspacesChannel = mainProcessClient.getChannel('workspaces');
serviceCollection.set(IWorkspacesService, new WorkspacesChannelClient(workspacesChannel));
......
......@@ -71,7 +71,6 @@ import { IExtensionManagementChannel, ExtensionManagementChannelClient } from 'v
import { IExtensionManagementService, IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { ExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionEnablementService';
import { ITimerService } from 'vs/workbench/services/timer/common/timerService';
import { remote } from 'electron';
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
import { restoreFontInfo, readFontInfo, saveFontInfo } from 'vs/editor/browser/config/configuration';
import * as browser from 'vs/base/browser/browser';
......@@ -101,8 +100,6 @@ export interface ICoreServices {
storageService: IStorageService;
}
const currentWindow = remote.getCurrentWindow();
/**
* The workbench shell contains the workbench with a rich header containing navigation and the activity bar.
* With the Shell being the top level element in the page, it is also responsible for driving the layouting.
......@@ -293,13 +290,13 @@ export class WorkbenchShell {
const instantiationService: IInstantiationService = new InstantiationService(serviceCollection, true);
this.broadcastService = new BroadcastService(currentWindow.id);
this.broadcastService = new BroadcastService(this.configuration.windowId);
serviceCollection.set(IBroadcastService, this.broadcastService);
serviceCollection.set(IWindowService, new SyncDescriptor(WindowService, currentWindow.id, this.configuration));
serviceCollection.set(IWindowService, new SyncDescriptor(WindowService, this.configuration.windowId, this.configuration));
const sharedProcess = (<IWindowsService>serviceCollection.get(IWindowsService)).whenSharedProcessReady()
.then(() => connectNet(this.environmentService.sharedIPCHandle, `window:${currentWindow.id}`));
.then(() => connectNet(this.environmentService.sharedIPCHandle, `window:${this.configuration.windowId}`));
sharedProcess
.done(client => client.registerChannel('choice', instantiationService.createInstance(ChoiceChannel)));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册