Merge from vscode 5b9869eb02fa4c96205a74d05cad9164dfd06d60 (#5607)

This commit is contained in:
Anthony Dresser
2019-05-24 12:20:30 -07:00
committed by GitHub
parent 361ada4963
commit bcc449b524
126 changed files with 3096 additions and 2255 deletions

View File

@@ -291,7 +291,7 @@ export class LifecycleService extends Disposable implements ILifecycleService {
});
}
unload(window: ICodeWindow, reason: UnloadReason): Promise<boolean /* veto */> {
async unload(window: ICodeWindow, reason: UnloadReason): Promise<boolean /* veto */> {
// Always allow to unload a window that is not yet ready
if (!window.isReady) {
@@ -302,27 +302,27 @@ export class LifecycleService extends Disposable implements ILifecycleService {
// first ask the window itself if it vetos the unload
const windowUnloadReason = this._quitRequested ? UnloadReason.QUIT : reason;
return this.onBeforeUnloadWindowInRenderer(window, windowUnloadReason).then(veto => {
if (veto) {
this.logService.trace(`Lifecycle#unload() - veto in renderer (window ID ${window.id})`);
let veto = await this.onBeforeUnloadWindowInRenderer(window, windowUnloadReason);
if (veto) {
this.logService.trace(`Lifecycle#unload() - veto in renderer (window ID ${window.id})`);
return this.handleWindowUnloadVeto(veto);
}
return this.handleWindowUnloadVeto(veto);
}
// then check for vetos in the main side
return this.onBeforeUnloadWindowInMain(window, windowUnloadReason).then(veto => {
if (veto) {
this.logService.trace(`Lifecycle#unload() - veto in main (window ID ${window.id})`);
// then check for vetos in the main side
veto = await this.onBeforeUnloadWindowInMain(window, windowUnloadReason);
if (veto) {
this.logService.trace(`Lifecycle#unload() - veto in main (window ID ${window.id})`);
return this.handleWindowUnloadVeto(veto);
}
return this.handleWindowUnloadVeto(veto);
}
this.logService.trace(`Lifecycle#unload() - no veto (window ID ${window.id})`);
this.logService.trace(`Lifecycle#unload() - no veto (window ID ${window.id})`);
// finally if there are no vetos, unload the renderer
return this.onWillUnloadWindowInRenderer(window, windowUnloadReason).then(() => false);
});
});
// finally if there are no vetos, unload the renderer
await this.onWillUnloadWindowInRenderer(window, windowUnloadReason);
return false;
}
private handleWindowUnloadVeto(veto: boolean): boolean {