提交 237e9e7c 编写于 作者: A Alex Dima

Have 1 mode worker in vscode and 2 for standalone editor

上级 5d76bbfd
......@@ -6,7 +6,6 @@
import { globals } from 'vs/base/common/platform';
export const workersCount = environment('workersCount', 2);
export const enableTasks = environment('enableTasks');
export const enableSendASmile = environment('enableSendASmile');
export const enableJavaScriptRewriting = environment('enableJavaScriptRewriting');
......@@ -25,4 +24,8 @@ function environment(name:string, fallback:any = false):any {
}
return fallback;
}
\ No newline at end of file
}
export function workersCount(defaultCount:number): number {
return environment('workersCount', defaultCount);
}
......@@ -179,7 +179,7 @@ export function getOrCreateStaticServices(services?: IEditorOverrideServices): I
console.warn('standaloneEditorTelemetryEndpoint is obsolete');
}
let threadService = services.threadService || new mainThreadService.MainThreadService(contextService, 'vs/editor/common/worker/editorWorkerServer');
let threadService = services.threadService || new mainThreadService.MainThreadService(contextService, 'vs/editor/common/worker/editorWorkerServer', 2);
let messageService = services.messageService || new SimpleServices.SimpleMessageService();
let pluginService = services.pluginService || new SimpleServices.SimplePluginService();
let markerService = services.markerService || new MarkerService.MainProcessMarkerService(threadService);
......
......@@ -43,11 +43,13 @@ export class MainThreadService extends abstractThreadService.AbstractThreadServi
private _workerFactory: Worker.IWorkerFactory;
private _workerModuleId: string;
private _defaultWorkerCount: number;
constructor(contextService: IWorkspaceContextService, workerModuleId: string) {
constructor(contextService: IWorkspaceContextService, workerModuleId: string, defaultWorkerCount: number) {
super(true);
this._contextService = contextService;
this._workerModuleId = workerModuleId;
this._defaultWorkerCount = defaultWorkerCount;
this._workerFactory = new DefaultWorkerFactory();
if (!this.isInMainThread) {
......@@ -72,7 +74,7 @@ export class MainThreadService extends abstractThreadService.AbstractThreadServi
if (this._triggerWorkersCreatedPromise) {
// Workers not created yet
let createCount = Env.workersCount;
let createCount = Env.workersCount(this._defaultWorkerCount);
if (!Platform.hasWebWorkerSupport()) {
// Create at most 1 compatibility worker
createCount = Math.min(createCount, 1);
......
......@@ -41,7 +41,7 @@ export class MainThreadService extends CommonMainThreadService {
private remoteCom: pluginsIPC.IPluginsIPC;
constructor(contextService: IWorkspaceContextService, messageService: IMessageService, windowService: IWindowService) {
super(contextService, 'vs/editor/common/worker/editorWorkerServer');
super(contextService, 'vs/editor/common/worker/editorWorkerServer', 1);
this.pluginHostProcessManager = new PluginHostProcessManager(contextService, messageService, windowService);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册