mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 02:26:04 +00:00
sandbox - drop setting to run shared process as hidden window
This commit is contained in:
parent
022a734b30
commit
ea5f26aea7
|
@ -26,7 +26,6 @@ import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/use
|
|||
import { IPolicyService } from 'vs/platform/policy/common/policy';
|
||||
import { ILoggerMainService } from 'vs/platform/log/electron-main/loggerService';
|
||||
import { UtilityProcess } from 'vs/platform/utilityProcess/electron-main/utilityProcess';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { canUseUtilityProcess } from 'vs/base/parts/sandbox/electron-main/electronTypes';
|
||||
import { parseSharedProcessDebugPort } from 'vs/platform/environment/node/environmentService';
|
||||
|
@ -42,19 +41,7 @@ export class SharedProcess extends Disposable implements ISharedProcess {
|
|||
private windowCloseListener: ((event: ElectronEvent) => void) | undefined = undefined;
|
||||
|
||||
private utilityProcess: UtilityProcess | undefined = undefined;
|
||||
private readonly useUtilityProcess = (() => {
|
||||
let useUtilityProcess = false;
|
||||
if (canUseUtilityProcess) {
|
||||
const sharedProcessUseUtilityProcess = this.configurationService.getValue<boolean>('window.experimental.sharedProcessUseUtilityProcess');
|
||||
if (typeof sharedProcessUseUtilityProcess === 'boolean') {
|
||||
useUtilityProcess = sharedProcessUseUtilityProcess;
|
||||
} else {
|
||||
useUtilityProcess = typeof product.quality === 'string';
|
||||
}
|
||||
}
|
||||
|
||||
return useUtilityProcess;
|
||||
})();
|
||||
private readonly useUtilityProcess = canUseUtilityProcess;
|
||||
|
||||
constructor(
|
||||
private readonly machineId: string,
|
||||
|
@ -66,8 +53,7 @@ export class SharedProcess extends Disposable implements ISharedProcess {
|
|||
@ILoggerMainService private readonly loggerMainService: ILoggerMainService,
|
||||
@IPolicyService private readonly policyService: IPolicyService,
|
||||
@IThemeMainService private readonly themeMainService: IThemeMainService,
|
||||
@IProtocolMainService private readonly protocolMainService: IProtocolMainService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||
@IProtocolMainService private readonly protocolMainService: IProtocolMainService
|
||||
) {
|
||||
super();
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ export interface IWindowSettings {
|
|||
readonly enableMenuBarMnemonics: boolean;
|
||||
readonly closeWhenEmpty: boolean;
|
||||
readonly clickThroughInactive: boolean;
|
||||
readonly experimental?: { useSandbox: boolean; sharedProcessUseUtilityProcess: boolean };
|
||||
readonly experimental?: { useSandbox: boolean };
|
||||
}
|
||||
|
||||
export function getTitleBarStyle(configurationService: IConfigurationService): 'native' | 'custom' {
|
||||
|
|
|
@ -1324,15 +1324,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
|||
}
|
||||
}
|
||||
|
||||
let preferUtilityProcess = false;
|
||||
if (canUseUtilityProcess) {
|
||||
if (typeof windowConfig?.experimental?.sharedProcessUseUtilityProcess === 'boolean') {
|
||||
preferUtilityProcess = windowConfig.experimental.sharedProcessUseUtilityProcess;
|
||||
} else {
|
||||
preferUtilityProcess = typeof product.quality === 'string';
|
||||
}
|
||||
}
|
||||
|
||||
// Build up the window configuration from provided options, config and environment
|
||||
const configuration: INativeWindowConfiguration = {
|
||||
|
||||
|
@ -1398,7 +1389,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
|||
policiesData: this.policyService.serialize(),
|
||||
continueOn: this.environmentMainService.continueOn,
|
||||
|
||||
preferUtilityProcess
|
||||
preferUtilityProcess: canUseUtilityProcess
|
||||
};
|
||||
|
||||
// New window
|
||||
|
|
|
@ -147,6 +147,7 @@ export class Workbench extends Layout {
|
|||
const configurationService = accessor.get(IConfigurationService);
|
||||
const hostService = accessor.get(IHostService);
|
||||
const dialogService = accessor.get(IDialogService);
|
||||
const notificationService = accessor.get(INotificationService) as NotificationService;
|
||||
|
||||
// Layout
|
||||
this.initLayout(accessor);
|
||||
|
@ -162,7 +163,7 @@ export class Workbench extends Layout {
|
|||
this.registerListeners(lifecycleService, storageService, configurationService, hostService, dialogService);
|
||||
|
||||
// Render Workbench
|
||||
this.renderWorkbench(instantiationService, accessor.get(INotificationService) as NotificationService, storageService, configurationService);
|
||||
this.renderWorkbench(instantiationService, notificationService, storageService, configurationService);
|
||||
|
||||
// Workbench Layout
|
||||
this.createWorkbenchLayout();
|
||||
|
|
|
@ -26,7 +26,7 @@ interface IConfiguration extends IWindowsConfiguration {
|
|||
debug?: { console?: { wordWrap?: boolean } };
|
||||
editor?: { accessibilitySupport?: 'on' | 'off' | 'auto' };
|
||||
security?: { workspace?: { trust?: { enabled?: boolean } } };
|
||||
window: IWindowSettings & { experimental?: { windowControlsOverlay?: { enabled?: boolean }; useSandbox?: boolean; sharedProcessUseUtilityProcess?: boolean } };
|
||||
window: IWindowSettings & { experimental?: { windowControlsOverlay?: { enabled?: boolean }; useSandbox?: boolean } };
|
||||
workbench?: { enableExperiments?: boolean };
|
||||
_extensionsGallery?: { enablePPE?: boolean };
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
|
|||
'window.titleBarStyle',
|
||||
'window.experimental.windowControlsOverlay.enabled',
|
||||
'window.experimental.useSandbox',
|
||||
'window.experimental.sharedProcessUseUtilityProcess',
|
||||
'window.nativeTabs',
|
||||
'window.nativeFullScreen',
|
||||
'window.clickThroughInactive',
|
||||
|
@ -51,7 +50,6 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
|
|||
private readonly titleBarStyle = new ChangeObserver<'native' | 'custom'>('string');
|
||||
private readonly windowControlsOverlayEnabled = new ChangeObserver('boolean');
|
||||
private readonly windowSandboxEnabled = new ChangeObserver('boolean');
|
||||
private readonly sharedProcessUtilityProcessEnabled = new ChangeObserver('boolean');
|
||||
private readonly nativeTabs = new ChangeObserver('boolean');
|
||||
private readonly nativeFullScreen = new ChangeObserver('boolean');
|
||||
private readonly clickThroughInactive = new ChangeObserver('boolean');
|
||||
|
@ -97,9 +95,6 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
|
|||
// Windows: Sandbox
|
||||
processChanged(this.windowSandboxEnabled.handleChange(config.window?.experimental?.useSandbox));
|
||||
|
||||
// Shared Process: Utility Process
|
||||
processChanged(this.sharedProcessUtilityProcessEnabled.handleChange(config.window?.experimental?.sharedProcessUseUtilityProcess));
|
||||
|
||||
// macOS: Native tabs
|
||||
processChanged(isMacintosh && this.nativeTabs.handleChange(config.window?.nativeTabs));
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
|||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
export class ToggleDevToolsAction extends Action2 {
|
||||
|
||||
|
@ -69,23 +68,6 @@ export class ConfigureRuntimeArgumentsAction extends Action2 {
|
|||
}
|
||||
}
|
||||
|
||||
export class ToggleSharedProcessAction extends Action2 {
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
id: 'workbench.action.toggleSharedProcess',
|
||||
title: { value: localize('toggleSharedProcess', "Toggle Shared Process"), original: 'Toggle Shared Process' },
|
||||
category: Categories.Developer,
|
||||
precondition: ContextKeyExpr.has('config.window.experimental.sharedProcessUseUtilityProcess').negate(),
|
||||
f1: true
|
||||
});
|
||||
}
|
||||
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
return accessor.get(INativeHostService).toggleSharedProcessWindow();
|
||||
}
|
||||
}
|
||||
|
||||
export class ReloadWindowWithExtensionsDisabledAction extends Action2 {
|
||||
|
||||
constructor() {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { MenuRegistry, MenuId, registerAction2 } from 'vs/platform/actions/commo
|
|||
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
import { ConfigureRuntimeArgumentsAction, ToggleDevToolsAction, ToggleSharedProcessAction, ReloadWindowWithExtensionsDisabledAction, OpenUserDataFolderAction } from 'vs/workbench/electron-sandbox/actions/developerActions';
|
||||
import { ConfigureRuntimeArgumentsAction, ToggleDevToolsAction, ReloadWindowWithExtensionsDisabledAction, OpenUserDataFolderAction } from 'vs/workbench/electron-sandbox/actions/developerActions';
|
||||
import { ZoomResetAction, ZoomOutAction, ZoomInAction, CloseWindowAction, SwitchWindowAction, QuickSwitchWindowAction, NewWindowTabHandler, ShowPreviousWindowTabHandler, ShowNextWindowTabHandler, MoveWindowTabToNewWindowHandler, MergeWindowTabsHandlerHandler, ToggleWindowTabsBarHandler } from 'vs/workbench/electron-sandbox/actions/windowActions';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
|
@ -106,7 +106,6 @@ import { applicationConfigurationNodeBase } from 'vs/workbench/common/configurat
|
|||
// Actions: Developer
|
||||
registerAction2(ReloadWindowWithExtensionsDisabledAction);
|
||||
registerAction2(ConfigureRuntimeArgumentsAction);
|
||||
registerAction2(ToggleSharedProcessAction);
|
||||
registerAction2(ToggleDevToolsAction);
|
||||
registerAction2(OpenUserDataFolderAction);
|
||||
})();
|
||||
|
@ -266,13 +265,6 @@ import { applicationConfigurationNodeBase } from 'vs/workbench/common/configurat
|
|||
tags: product.quality === 'stable' ? ['experimental'] : undefined,
|
||||
'scope': ConfigurationScope.APPLICATION,
|
||||
ignoreSync: true
|
||||
},
|
||||
'window.experimental.sharedProcessUseUtilityProcess': { // TODO@bpasero remove me once sandbox is final
|
||||
type: 'boolean',
|
||||
description: localize('experimentalUseSharedProcessUseUtilityProcess', "Experimental: When enabled, the window will have sandbox mode enabled via Electron API."),
|
||||
default: typeof product.quality === 'string',
|
||||
'scope': ConfigurationScope.APPLICATION,
|
||||
ignoreSync: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue