Skip to content

Commit c8fa927

Browse files
author
Benjamin Pasero
committed
debt - have methods for restart, relaunch
1 parent e211ef1 commit c8fa927

29 files changed

Lines changed: 225 additions & 120 deletions

File tree

src/vs/platform/electron/electron-main/electronMainService.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
import { IElectronService } from 'vs/platform/electron/node/electron';
77
import { IWindowsMainService, ICodeWindow } from 'vs/platform/windows/electron-main/windows';
88
import { MessageBoxOptions, MessageBoxReturnValue, shell } from 'electron';
9+
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
910

1011
export class ElectronMainService implements IElectronService {
1112

1213
_serviceBrand: undefined;
1314

1415
constructor(
15-
@IWindowsMainService private readonly windowsMainService: IWindowsMainService
16+
@IWindowsMainService private readonly windowsMainService: IWindowsMainService,
17+
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService
1618
) {
1719
}
1820

@@ -43,5 +45,9 @@ export class ElectronMainService implements IElectronService {
4345
shell.showItemInFolder(path);
4446
}
4547

48+
async relaunch(options?: { addArgs?: string[], removeArgs?: string[] }): Promise<void> {
49+
return this.lifecycleMainService.relaunch(options);
50+
}
51+
4652
//#endregion
4753
}

src/vs/platform/electron/node/electron.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ export interface IElectronService {
2020

2121
// OS
2222
showItemInFolder(path: string): Promise<void>;
23+
relaunch(options?: { addArgs?: string[], removeArgs?: string[] }): Promise<void>;
2324
}

src/vs/platform/environment/node/argvHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as assert from 'assert';
77
import { firstIndex } from 'vs/base/common/arrays';
88
import { localize } from 'vs/nls';
99
import { ParsedArgs } from '../common/environment';
10-
import { MIN_MAX_MEMORY_SIZE_MB } from 'vs/platform/files/common/files';
10+
import { MIN_MAX_MEMORY_SIZE_MB } from 'vs/platform/files/node/files';
1111
import { parseArgs, ErrorReporter, OPTIONS } from 'vs/platform/environment/node/argv';
1212

1313
function parseAndValidate(cmdLineArgs: string[], reportWarnings: boolean): ParsedArgs {

src/vs/platform/files/common/files.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,6 @@ export enum FileKind {
754754
ROOT_FOLDER
755755
}
756756

757-
export const MIN_MAX_MEMORY_SIZE_MB = 2048;
758-
export const FALLBACK_MAX_MEMORY_SIZE_MB = 4096;
759-
760757
/**
761758
* A hint to disable etag checking for reading/writing.
762759
*/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
export const MIN_MAX_MEMORY_SIZE_MB = 2048;
7+
export const FALLBACK_MAX_MEMORY_SIZE_MB = 4096;

src/vs/platform/windows/common/windows.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ export interface IWindowsService {
133133
onWindowTitleDoubleClick(windowId: number): Promise<void>;
134134
setDocumentEdited(windowId: number, flag: boolean): Promise<void>;
135135
quit(): Promise<void>;
136-
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): Promise<void>;
137136

138137
// macOS Native Tabs
139138
newWindowTab(): Promise<void>;

src/vs/platform/windows/common/windowsIpc.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export class WindowsChannel implements IServerChannel {
104104
case 'openNewWindow': return this.service.openNewWindow(arg);
105105
case 'openExtensionDevelopmentHostWindow': return this.service.openExtensionDevelopmentHostWindow(arg[0], arg[1]);
106106
case 'getWindows': return this.service.getWindows();
107-
case 'relaunch': return this.service.relaunch(arg[0]);
108107
case 'whenSharedProcessReady': return this.service.whenSharedProcessReady();
109108
case 'toggleSharedProcess': return this.service.toggleSharedProcess();
110109
case 'quit': return this.service.quit();

src/vs/platform/windows/electron-browser/windowsService.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,6 @@ export class WindowsService implements IWindowsService {
176176
return this.channel.call('quit');
177177
}
178178

179-
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): Promise<void> {
180-
return this.channel.call('relaunch', [options]);
181-
}
182-
183179
whenSharedProcessReady(): Promise<void> {
184180
return this.channel.call('whenSharedProcessReady');
185181
}

src/vs/platform/windows/electron-main/windowsService.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/
1111
import { shell, crashReporter, app, Menu } from 'electron';
1212
import { Event } from 'vs/base/common/event';
1313
import { IURLService, IURLHandler } from 'vs/platform/url/common/url';
14-
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
1514
import { IWindowsMainService, ISharedProcess, ICodeWindow } from 'vs/platform/windows/electron-main/windows';
1615
import { IRecentlyOpened, IRecent } from 'vs/platform/history/common/history';
1716
import { IHistoryMainService } from 'vs/platform/history/electron-main/historyMainService';
@@ -45,7 +44,6 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
4544
@IWindowsMainService private readonly windowsMainService: IWindowsMainService,
4645
@IEnvironmentService private readonly environmentService: IEnvironmentService,
4746
@IURLService urlService: IURLService,
48-
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
4947
@IHistoryMainService private readonly historyMainService: IHistoryMainService,
5048
@ILogService private readonly logService: ILogService
5149
) {
@@ -359,12 +357,6 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
359357
this.windowsMainService.quit();
360358
}
361359

362-
async relaunch(options: { addArgs?: string[], removeArgs?: string[] }): Promise<void> {
363-
this.logService.trace('windowsService#relaunch');
364-
365-
this.lifecycleMainService.relaunch(options);
366-
}
367-
368360
async whenSharedProcessReady(): Promise<void> {
369361
this.logService.trace('windowsService#whenSharedProcessReady');
370362

src/vs/workbench/browser/web.simpleservices.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,12 +428,6 @@ export class SimpleWindowsService implements IWindowsService {
428428
return Promise.resolve();
429429
}
430430

431-
relaunch(_options: { addArgs?: string[], removeArgs?: string[] }): Promise<void> {
432-
window.location.reload();
433-
434-
return Promise.resolve();
435-
}
436-
437431
whenSharedProcessReady(): Promise<void> {
438432
return Promise.resolve();
439433
}

0 commit comments

Comments
 (0)