@@ -20,7 +20,6 @@ import { IProcessEnvironment, isLinux, isLinuxSnap, isMacintosh, isWindows, OS }
20
20
import { assertType } from 'vs/base/common/types' ;
21
21
import { URI } from 'vs/base/common/uri' ;
22
22
import { generateUuid } from 'vs/base/common/uuid' ;
23
- import { getMachineId } from 'vs/base/node/id' ;
24
23
import { registerContextMenuListener } from 'vs/base/parts/contextmenu/electron-main/contextmenu' ;
25
24
import { getDelayedChannel , ProxyChannel , StaticRouter } from 'vs/base/parts/ipc/common/ipc' ;
26
25
import { Server as ElectronIPCServer } from 'vs/base/parts/ipc/electron-main/ipc.electron' ;
@@ -71,7 +70,7 @@ import { IStateMainService } from 'vs/platform/state/electron-main/state';
71
70
import { StorageDatabaseChannel } from 'vs/platform/storage/electron-main/storageIpc' ;
72
71
import { ApplicationStorageMainService , IApplicationStorageMainService , IStorageMainService , StorageMainService } from 'vs/platform/storage/electron-main/storageMainService' ;
73
72
import { resolveCommonProperties } from 'vs/platform/telemetry/common/commonProperties' ;
74
- import { ITelemetryService , machineIdKey , TelemetryLevel } from 'vs/platform/telemetry/common/telemetry' ;
73
+ import { ITelemetryService , TelemetryLevel } from 'vs/platform/telemetry/common/telemetry' ;
75
74
import { TelemetryAppenderClient } from 'vs/platform/telemetry/common/telemetryIpc' ;
76
75
import { ITelemetryServiceConfig , TelemetryService } from 'vs/platform/telemetry/common/telemetryService' ;
77
76
import { getPiiPathsFromEnvironment , getTelemetryLevel , isInternalTelemetry , NullTelemetryService , supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils' ;
@@ -109,6 +108,7 @@ import { ExtensionsScannerService } from 'vs/platform/extensionManagement/node/e
109
108
import { UserDataTransientProfilesHandler } from 'vs/platform/userDataProfile/electron-main/userDataTransientProfilesHandler' ;
110
109
import { ProfileStorageChangesListenerChannel } from 'vs/platform/userDataProfile/electron-main/userDataProfileStorageIpc' ;
111
110
import { Promises , RunOnceScheduler , runWhenIdle } from 'vs/base/common/async' ;
111
+ import { resolveMachineId } from 'vs/platform/telemetry/electron-main/telemetryUtils' ;
112
112
113
113
/**
114
114
* The main VS Code application. There will only ever be one instance,
@@ -524,7 +524,7 @@ export class CodeApplication extends Disposable {
524
524
525
525
// Resolve unique machine ID
526
526
this . logService . trace ( 'Resolving machine identifier...' ) ;
527
- const machineId = await this . resolveMachineId ( ) ;
527
+ const machineId = await resolveMachineId ( this . stateMainService ) ;
528
528
this . logService . trace ( `Resolved machine identifier: ${ machineId } ` ) ;
529
529
530
530
// Shared process
@@ -561,20 +561,6 @@ export class CodeApplication extends Disposable {
561
561
this . _register ( instantiationService . createInstance ( UserDataTransientProfilesHandler ) ) ;
562
562
}
563
563
564
- private async resolveMachineId ( ) : Promise < string > {
565
-
566
- // We cache the machineId for faster lookups on startup
567
- // and resolve it only once initially if not cached or we need to replace the macOS iBridge device
568
- let machineId = this . stateMainService . getItem < string > ( machineIdKey ) ;
569
- if ( ! machineId || ( isMacintosh && machineId === '6c9d2bc8f91b89624add29c0abeae7fb42bf539fa1cdb2e3e57cd668fa9bcead' ) ) {
570
- machineId = await getMachineId ( ) ;
571
-
572
- this . stateMainService . setItem ( machineIdKey , machineId ) ;
573
- }
574
-
575
- return machineId ;
576
- }
577
-
578
564
private setupSharedProcess ( machineId : string ) : { sharedProcess : SharedProcess ; sharedProcessReady : Promise < MessagePortClient > ; sharedProcessClient : Promise < MessagePortClient > } {
579
565
const sharedProcess = this . _register ( this . mainInstantiationService . createInstance ( SharedProcess , machineId , this . userEnv ) ) ;
580
566
0 commit comments