提交 7b2b4b93 编写于 作者: J Joao Moreno

ipc: remove vscode:telemetry

上级 14713079
......@@ -84,10 +84,9 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
const instantiationService = accessor.get(IInstantiationService);
const logService = accessor.get(ILogService);
const environmentService = accessor.get(IEnvironmentService);
const windowsMainService = accessor.get(IWindowsMainService);
const lifecycleService = accessor.get(ILifecycleService);
const configurationService = accessor.get(IConfigurationService) as ConfigurationService<any>;
const windowEventChannel = new WindowEventChannel(windowsMainService);
let windowsMainService: IWindowsMainService;
// We handle uncaught exceptions here to prevent electron from opening a dialog to the user
process.on('uncaughtException', (err: any) => {
......@@ -100,7 +99,9 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
};
// handle on client side
windowsMainService.sendToFocused('vscode:reportError', JSON.stringify(friendlyError));
if (windowsMainService) {
windowsMainService.sendToFocused('vscode:reportError', JSON.stringify(friendlyError));
}
}
console.error('[uncaught exception in main]: ' + err);
......@@ -141,10 +142,6 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
const urlChannel = instantiationService.createInstance(URLChannel, urlService);
electronIpcServer.registerChannel('url', urlChannel);
const windowsService = accessor.get(IWindowsService);
const windowsChannel = new WindowsChannel(windowsService);
electronIpcServer.registerChannel('windows', windowsChannel);
// Spawn shared process
const initData = { args: environmentService.args };
const options = {
......@@ -163,7 +160,10 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
// requires a connection to shared process, which was only established
// now.
const services = new ServiceCollection();
services.set(IUpdateService, new SyncDescriptor(UpdateService));
services.set(IWindowsMainService, new SyncDescriptor(WindowsManager));
services.set(IWindowsService, new SyncDescriptor(WindowsService));
if (environmentService.isBuilt && !environmentService.extensionDevelopmentPath && !!product.enableTelemetry) {
const channel = getDelayedChannel<ITelemetryAppenderChannel>(sharedProcess.then(c => c.getChannel('telemetryAppender')));
......@@ -184,7 +184,14 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
const updateChannel = new UpdateChannel(updateService);
electronIpcServer.registerChannel('update', updateChannel);
const windowsService = accessor.get(IWindowsService);
const windowsChannel = new WindowsChannel(windowsService);
electronIpcServer.registerChannel('windows', windowsChannel);
// TODO@Joao revisit this
// Register windowEvent
windowsMainService = accessor.get(IWindowsMainService);
const windowEventChannel = new WindowEventChannel(windowsMainService);
sharedProcess.done(client => client.registerChannel('windowEvent', windowEventChannel));
// Make sure we associate the program with the app user model id
......@@ -485,8 +492,6 @@ function createServices(args): IInstantiationService {
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, args, process.execPath));
services.set(ILogService, new SyncDescriptor(MainLogService));
services.set(IWindowsMainService, new SyncDescriptor(WindowsManager));
services.set(IWindowsService, new SyncDescriptor(WindowsService));
services.set(ILifecycleService, new SyncDescriptor(LifecycleService));
services.set(IStorageService, new SyncDescriptor(StorageService));
services.set(IConfigurationService, new SyncDescriptor(ConfigurationService));
......
......@@ -15,6 +15,7 @@ import { IPath, VSCodeWindow } from 'vs/code/electron-main/window';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IStorageService } from 'vs/code/electron-main/storage';
import { IFilesConfiguration, AutoSaveConfiguration } from 'vs/platform/files/common/files';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IUpdateService, State as UpdateState } from 'vs/platform/update/common/update';
import { Keybinding } from 'vs/base/common/keybinding';
import product from 'vs/platform/product';
......@@ -58,7 +59,8 @@ export class VSCodeMenu {
@IUpdateService private updateService: IUpdateService,
@IConfigurationService private configurationService: IConfigurationService,
@IWindowsMainService private windowsService: IWindowsMainService,
@IEnvironmentService private environmentService: IEnvironmentService
@IEnvironmentService private environmentService: IEnvironmentService,
@ITelemetryService private telemetryService: ITelemetryService
) {
this.actionIdKeybindingRequests = [];
......@@ -884,7 +886,7 @@ export class VSCodeMenu {
}
private reportMenuActionTelemetry(id: string): void {
this.windowsService.sendToFocused('vscode:telemetry', { eventName: 'workbenchActionExecuted', data: { id, from: 'menu' } });
this.telemetryService.publicLog('workbenchActionExecuted', { id, from: 'menu' });
}
}
......
......@@ -25,6 +25,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ILogService } from 'vs/code/electron-main/log';
import { IWindowEventService } from 'vs/code/common/windows';
import { createDecorator, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import CommonEvent, { Emitter } from 'vs/base/common/event';
import product from 'vs/platform/product';
import { ParsedArgs } from 'vs/platform/environment/node/argv';
......@@ -152,7 +153,8 @@ export class WindowsManager implements IWindowsMainService, IWindowEventService
@IStorageService private storageService: IStorageService,
@IEnvironmentService private environmentService: IEnvironmentService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IConfigurationService private configurationService: IConfigurationService
@IConfigurationService private configurationService: IConfigurationService,
@ITelemetryService private telemetryService: ITelemetryService
) { }
onOpen(clb: (path: IPath) => void): () => void {
......@@ -296,7 +298,7 @@ export class WindowsManager implements IWindowsMainService, IWindowEventService
this.logService.log(error); // be on the safe side with these hardware method calls
}
window.send('vscode:telemetry', { eventName: 'startupTime', data: { ellapsed: Date.now() - global.vscodeStart, totalmem, cpus } });
this.telemetryService.publicLog('startupTime', { ellapsed: Date.now() - global.vscodeStart, totalmem, cpus });
}
private onBroadcast(event: string, payload: any): void {
......
......@@ -107,10 +107,6 @@ export class ElectronIntegration {
}, () => errors.onUnexpectedError);
});
ipc.on('vscode:telemetry', (event, { eventName, data }) => {
this.telemetryService.publicLog(eventName, data);
});
ipc.on('vscode:reportError', (event, error) => {
if (error) {
const errorParsed = JSON.parse(error);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册