|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information. |
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | | -import { app, BrowserWindow, contentTracing, dialog, protocol, session, Session, systemPreferences, WebFrameMain } from 'electron'; |
| 6 | +import { app, BrowserWindow, dialog, protocol, session, Session, systemPreferences, WebFrameMain } from 'electron'; |
7 | 7 | import { validatedIpcMain } from 'vs/base/parts/ipc/electron-main/ipcMain'; |
8 | 8 | import { statSync } from 'fs'; |
9 | 9 | import { hostname, release } from 'os'; |
10 | 10 | import { VSBuffer } from 'vs/base/common/buffer'; |
11 | 11 | import { toErrorMessage } from 'vs/base/common/errorMessage'; |
12 | 12 | import { onUnexpectedError, setUnexpectedErrorHandler } from 'vs/base/common/errors'; |
13 | | -import { isEqualOrParent, randomPath } from 'vs/base/common/extpath'; |
| 13 | +import { isEqualOrParent } from 'vs/base/common/extpath'; |
14 | 14 | import { once } from 'vs/base/common/functional'; |
15 | 15 | import { stripComments } from 'vs/base/common/json'; |
16 | 16 | import { getPathLabel, mnemonicButtonLabel } from 'vs/base/common/labels'; |
17 | 17 | import { Disposable } from 'vs/base/common/lifecycle'; |
18 | 18 | import { Schemas } from 'vs/base/common/network'; |
19 | 19 | import { isAbsolute, join, posix } from 'vs/base/common/path'; |
20 | 20 | import { IProcessEnvironment, isLinux, isLinuxSnap, isMacintosh, isWindows, OS } from 'vs/base/common/platform'; |
21 | | -import { assertType, withNullAsUndefined } from 'vs/base/common/types'; |
| 21 | +import { assertType } from 'vs/base/common/types'; |
22 | 22 | import { URI } from 'vs/base/common/uri'; |
23 | 23 | import { generateUuid } from 'vs/base/common/uuid'; |
24 | 24 | import { getMachineId } from 'vs/base/node/id'; |
@@ -546,16 +546,11 @@ export class CodeApplication extends Disposable { |
546 | 546 | appInstantiationService.invokeFunction(accessor => this.initChannels(accessor, mainProcessElectronServer, sharedProcessClient)); |
547 | 547 |
|
548 | 548 | // Open Windows |
549 | | - const windows = appInstantiationService.invokeFunction(accessor => this.openFirstWindow(accessor, profile, mainProcessElectronServer)); |
| 549 | + appInstantiationService.invokeFunction(accessor => this.openFirstWindow(accessor, profile, mainProcessElectronServer)); |
550 | 550 |
|
551 | 551 | // Post Open Windows Tasks |
552 | 552 | appInstantiationService.invokeFunction(accessor => this.afterWindowOpen(accessor, sharedProcess)); |
553 | 553 |
|
554 | | - // Tracing: Stop tracing after windows are ready if enabled |
555 | | - if (this.environmentMainService.args.trace) { |
556 | | - appInstantiationService.invokeFunction(accessor => this.stopTracingEventually(accessor, windows)); |
557 | | - } |
558 | | - |
559 | 554 | // Set lifecycle phase to `Eventually` after a short delay and when idle (min 2.5sec, max 5sec) |
560 | 555 | const eventuallyPhaseScheduler = this._register(new RunOnceScheduler(() => { |
561 | 556 | this._register(runWhenIdle(() => this.lifecycleMainService.phase = LifecycleMainPhase.Eventually, 2500)); |
@@ -1281,44 +1276,4 @@ export class CodeApplication extends Disposable { |
1281 | 1276 | this.logService.error(error); |
1282 | 1277 | } |
1283 | 1278 | } |
1284 | | - |
1285 | | - private stopTracingEventually(accessor: ServicesAccessor, windows: ICodeWindow[]): void { |
1286 | | - this.logService.info('Tracing: waiting for windows to get ready...'); |
1287 | | - |
1288 | | - const dialogMainService = accessor.get(IDialogMainService); |
1289 | | - |
1290 | | - let recordingStopped = false; |
1291 | | - const stopRecording = async (timeout: boolean) => { |
1292 | | - if (recordingStopped) { |
1293 | | - return; |
1294 | | - } |
1295 | | - |
1296 | | - recordingStopped = true; // only once |
1297 | | - |
1298 | | - const path = await contentTracing.stopRecording(`${randomPath(this.environmentMainService.userHome.fsPath, this.productService.applicationName)}.trace.txt`); |
1299 | | - |
1300 | | - if (!timeout) { |
1301 | | - dialogMainService.showMessageBox({ |
1302 | | - title: this.productService.nameLong, |
1303 | | - type: 'info', |
1304 | | - message: localize('trace.message', "Successfully created trace."), |
1305 | | - detail: localize('trace.detail', "Please create an issue and manually attach the following file:\n{0}", path), |
1306 | | - buttons: [mnemonicButtonLabel(localize({ key: 'trace.ok', comment: ['&& denotes a mnemonic'] }, "&&OK"))], |
1307 | | - defaultId: 0, |
1308 | | - noLink: true |
1309 | | - }, withNullAsUndefined(BrowserWindow.getFocusedWindow())); |
1310 | | - } else { |
1311 | | - this.logService.info(`Tracing: data recorded (after 30s timeout) to ${path}`); |
1312 | | - } |
1313 | | - }; |
1314 | | - |
1315 | | - // Wait up to 30s before creating the trace anyways |
1316 | | - const timeoutHandle = setTimeout(() => stopRecording(true), 30000); |
1317 | | - |
1318 | | - // Wait for all windows to get ready and stop tracing then |
1319 | | - Promise.all(windows.map(window => window.ready())).then(() => { |
1320 | | - clearTimeout(timeoutHandle); |
1321 | | - stopRecording(false); |
1322 | | - }); |
1323 | | - } |
1324 | 1279 | } |
0 commit comments