提交 a412a14d 编写于 作者: J Johannes Rieken

Revert "reuse telemetry info when getting common http headers, will likely...

Revert "reuse telemetry info when getting common http headers, will likely make use not spawn a process which saves at least 10ms,  #17108"

This reverts commit 8a41bdb7.
上级 bc46e789
......@@ -14,10 +14,9 @@ import { TPromise, TValueCallback } from 'vs/base/common/winjs.base';
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
import { ILogService } from 'vs/code/electron-main/log';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { parseArgs } from 'vs/platform/environment/node/argv';
import product from 'vs/platform/node/product';
import { getCommonHttpHeaders } from 'vs/platform/environment/node/http';
import { getCommonHTTPHeaders } from 'vs/platform/environment/node/http';
import { IWindowSettings } from 'vs/platform/windows/common/windows';
export interface IWindowState {
......@@ -155,8 +154,7 @@ export class VSCodeWindow implements IVSCodeWindow {
@ILogService private logService: ILogService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IConfigurationService private configurationService: IConfigurationService,
@IStorageService private storageService: IStorageService,
@ITelemetryService private telemetryService: ITelemetryService
@IStorageService private storageService: IStorageService
) {
this.options = config;
this._lastFocusTime = -1;
......@@ -210,7 +208,7 @@ export class VSCodeWindow implements IVSCodeWindow {
// TODO@joao: hook this up to some initialization routine
// this causes a race between setting the headers and doing
// a request that needs them. chances are low
getCommonHttpHeaders(this.telemetryService).done(headers => {
getCommonHTTPHeaders().done(headers => {
if (!this._win) {
return;
}
......
......@@ -22,7 +22,6 @@ import { ipcMain as ipc, app, screen, BrowserWindow, dialog } from 'electron';
import { IPathWithLineAndColumn, parseLineAndColumnAware } from 'vs/code/electron-main/paths';
import { ILifecycleService, UnloadReason } from 'vs/code/electron-main/lifecycle';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { ILogService } from 'vs/code/electron-main/log';
import { getPathLabel } from 'vs/base/common/labels';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
......@@ -149,8 +148,7 @@ export class WindowsManager implements IWindowsMainService {
@IEnvironmentService private environmentService: IEnvironmentService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IBackupMainService private backupService: IBackupMainService,
@IConfigurationService private configurationService: IConfigurationService,
@ITelemetryService private telemetryService: ITelemetryService
@IConfigurationService private configurationService: IConfigurationService
) { }
public ready(initialUserEnv: platform.IProcessEnvironment): void {
......@@ -736,8 +734,7 @@ export class WindowsManager implements IWindowsMainService {
this.logService,
this.environmentService,
this.configurationService,
this.storageService,
this.telemetryService
this.storageService
);
WindowsManager.WINDOWS.push(vscodeWindow);
......
......@@ -4,13 +4,13 @@
*--------------------------------------------------------------------------------------------*/
import { TPromise } from 'vs/base/common/winjs.base';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { getMachineId } from 'vs/base/node/id';
import pkg from 'vs/platform/node/package';
export function getCommonHttpHeaders(telemetryService: ITelemetryService): TPromise<{ [key: string]: string }> {
return telemetryService.getTelemetryInfo().then(info => ({
export function getCommonHTTPHeaders(): TPromise<{ [key: string]: string; }> {
return getMachineId().then(machineId => ({
'X-Market-Client-Id': `VSCode ${pkg.version}`,
'User-Agent': `VSCode ${pkg.version}`,
'X-Market-User-Id': info.machineId
'X-Market-User-Id': machineId
}));
}
}
\ No newline at end of file
......@@ -21,7 +21,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import pkg from 'vs/platform/node/package';
import product from 'vs/platform/node/product';
import { isVersionValid } from 'vs/platform/extensions/node/extensionValidator';
import { getCommonHttpHeaders } from 'vs/platform/environment/node/http';
import { getCommonHTTPHeaders } from 'vs/platform/environment/node/http';
interface IRawGalleryExtensionFile {
assetType: string;
......@@ -265,6 +265,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
_serviceBrand: any;
private extensionsGalleryUrl: string;
private readonly commonHTTPHeaders: TPromise<{ [key: string]: string; }>;
constructor(
......@@ -274,7 +275,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
) {
const config = product.extensionsGallery;
this.extensionsGalleryUrl = config && config.serviceUrl;
this.commonHTTPHeaders = getCommonHttpHeaders(this.telemetryService);
this.commonHTTPHeaders = getCommonHTTPHeaders();
}
private api(path = ''): string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册