mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 19:18:32 -05:00
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
@@ -7,9 +7,8 @@
|
||||
|
||||
import { ipcMain as ipc, app } from 'electron';
|
||||
import { TPromise, TValueCallback } from 'vs/base/common/winjs.base';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IStorageService } from 'vs/platform/storage/node/storage';
|
||||
import { IStateService } from 'vs/platform/state/common/state';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ICodeWindow } from 'vs/platform/windows/electron-main/windows';
|
||||
@@ -75,7 +74,7 @@ export class LifecycleService implements ILifecycleService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private static QUIT_FROM_RESTART_MARKER = 'quit.from.restart'; // use a marker to find out if the session was restarted
|
||||
private static readonly QUIT_FROM_RESTART_MARKER = 'quit.from.restart'; // use a marker to find out if the session was restarted
|
||||
|
||||
private windowToCloseRequest: { [windowId: string]: boolean };
|
||||
private quitRequested: boolean;
|
||||
@@ -94,9 +93,8 @@ export class LifecycleService implements ILifecycleService {
|
||||
onBeforeWindowUnload: Event<IWindowUnloadEvent> = this._onBeforeWindowUnload.event;
|
||||
|
||||
constructor(
|
||||
@IEnvironmentService private environmentService: IEnvironmentService,
|
||||
@ILogService private logService: ILogService,
|
||||
@IStorageService private storageService: IStorageService
|
||||
@IStateService private stateService: IStateService
|
||||
) {
|
||||
this.windowToCloseRequest = Object.create(null);
|
||||
this.quitRequested = false;
|
||||
@@ -107,10 +105,10 @@ export class LifecycleService implements ILifecycleService {
|
||||
}
|
||||
|
||||
private handleRestarted(): void {
|
||||
this._wasRestarted = !!this.storageService.getItem(LifecycleService.QUIT_FROM_RESTART_MARKER);
|
||||
this._wasRestarted = !!this.stateService.getItem(LifecycleService.QUIT_FROM_RESTART_MARKER);
|
||||
|
||||
if (this._wasRestarted) {
|
||||
this.storageService.removeItem(LifecycleService.QUIT_FROM_RESTART_MARKER); // remove the marker right after if found
|
||||
this.stateService.removeItem(LifecycleService.QUIT_FROM_RESTART_MARKER); // remove the marker right after if found
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +124,7 @@ export class LifecycleService implements ILifecycleService {
|
||||
|
||||
// before-quit
|
||||
app.on('before-quit', (e) => {
|
||||
this.logService.log('Lifecycle#before-quit');
|
||||
this.logService.trace('Lifecycle#before-quit');
|
||||
|
||||
if (!this.quitRequested) {
|
||||
this._onBeforeQuit.fire(); // only send this if this is the first quit request we have
|
||||
@@ -137,7 +135,7 @@ export class LifecycleService implements ILifecycleService {
|
||||
|
||||
// window-all-closed
|
||||
app.on('window-all-closed', () => {
|
||||
this.logService.log('Lifecycle#window-all-closed');
|
||||
this.logService.trace('Lifecycle#window-all-closed');
|
||||
|
||||
// Windows/Linux: we quit when all windows have closed
|
||||
// Mac: we only quit when quit was requested
|
||||
@@ -152,11 +150,11 @@ export class LifecycleService implements ILifecycleService {
|
||||
// Window Before Closing: Main -> Renderer
|
||||
window.win.on('close', e => {
|
||||
const windowId = window.id;
|
||||
this.logService.log('Lifecycle#window-before-close', windowId);
|
||||
this.logService.trace('Lifecycle#window-before-close', windowId);
|
||||
|
||||
// The window already acknowledged to be closed
|
||||
if (this.windowToCloseRequest[windowId]) {
|
||||
this.logService.log('Lifecycle#window-close', windowId);
|
||||
this.logService.trace('Lifecycle#window-close', windowId);
|
||||
|
||||
delete this.windowToCloseRequest[windowId];
|
||||
|
||||
@@ -185,7 +183,7 @@ export class LifecycleService implements ILifecycleService {
|
||||
return TPromise.as<boolean>(false);
|
||||
}
|
||||
|
||||
this.logService.log('Lifecycle#unload()', window.id);
|
||||
this.logService.trace('Lifecycle#unload()', window.id);
|
||||
|
||||
const windowUnloadReason = this.quitRequested ? UnloadReason.QUIT : reason;
|
||||
|
||||
@@ -249,7 +247,7 @@ export class LifecycleService implements ILifecycleService {
|
||||
* by the user or not.
|
||||
*/
|
||||
public quit(fromUpdate?: boolean): TPromise<boolean /* veto */> {
|
||||
this.logService.log('Lifecycle#quit()');
|
||||
this.logService.trace('Lifecycle#quit()');
|
||||
|
||||
if (!this.pendingQuitPromise) {
|
||||
this.pendingQuitPromise = new TPromise<boolean>(c => {
|
||||
@@ -260,7 +258,7 @@ export class LifecycleService implements ILifecycleService {
|
||||
app.once('will-quit', () => {
|
||||
if (this.pendingQuitPromiseComplete) {
|
||||
if (fromUpdate) {
|
||||
this.storageService.setItem(LifecycleService.QUIT_FROM_RESTART_MARKER, true);
|
||||
this.stateService.setItem(LifecycleService.QUIT_FROM_RESTART_MARKER, true);
|
||||
}
|
||||
|
||||
this.pendingQuitPromiseComplete(false /* no veto */);
|
||||
@@ -298,7 +296,7 @@ export class LifecycleService implements ILifecycleService {
|
||||
let vetoed = false;
|
||||
app.once('quit', () => {
|
||||
if (!vetoed) {
|
||||
this.storageService.setItem(LifecycleService.QUIT_FROM_RESTART_MARKER, true);
|
||||
this.stateService.setItem(LifecycleService.QUIT_FROM_RESTART_MARKER, true);
|
||||
app.relaunch({ args });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user