@@ -14,7 +14,7 @@ import { ILogService } from 'vs/platform/log/common/log';
14
14
import { INotificationService } from 'vs/platform/notification/common/notification' ;
15
15
import { Registry } from 'vs/platform/registry/common/platform' ;
16
16
import { IStorageService , StorageScope , StorageTarget } from 'vs/platform/storage/common/storage' ;
17
- import { ILocalPtyService , IProcessPropertyMap , IShellLaunchConfig , ITerminalChildProcess , ITerminalEnvironment , ITerminalProcessOptions , ITerminalsLayoutInfo , ITerminalsLayoutInfoById , ProcessPropertyType , TerminalSettingId , TitleEventSource } from 'vs/platform/terminal/common/terminal' ;
17
+ import { ILocalPtyService , IProcessPropertyMap , IPtyService , IShellLaunchConfig , ITerminalChildProcess , ITerminalEnvironment , ITerminalProcessOptions , ITerminalsLayoutInfo , ITerminalsLayoutInfoById , ProcessPropertyType , TerminalIpcChannels , TerminalSettingId , TitleEventSource } from 'vs/platform/terminal/common/terminal' ;
18
18
import { IGetTerminalLayoutInfoArgs , IProcessDetails , ISetTerminalLayoutInfoArgs } from 'vs/platform/terminal/common/terminalProcess' ;
19
19
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
20
20
import { IWorkbenchContribution } from 'vs/workbench/common/contributions' ;
@@ -30,6 +30,10 @@ import { IProductService } from 'vs/platform/product/common/productService';
30
30
import { IEnvironmentVariableService } from 'vs/workbench/contrib/terminal/common/environmentVariable' ;
31
31
import { BaseTerminalBackend } from 'vs/workbench/contrib/terminal/browser/baseTerminalBackend' ;
32
32
import { getWorkspaceForTerminal } from 'vs/workbench/services/configurationResolver/common/terminalResolver' ;
33
+ import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService' ;
34
+ import { Client as MessagePortClient } from 'vs/base/parts/ipc/common/ipc.mp' ;
35
+ import { acquirePort } from 'vs/base/parts/ipc/electron-sandbox/ipc.mp' ;
36
+ import { ProxyChannel } from 'vs/base/parts/ipc/common/ipc' ;
33
37
34
38
export class LocalTerminalBackendContribution implements IWorkbenchContribution {
35
39
constructor (
@@ -66,9 +70,30 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke
66
70
@IEnvironmentVariableService private readonly _environmentVariableService : IEnvironmentVariableService ,
67
71
@INotificationService notificationService : INotificationService ,
68
72
@IHistoryService historyService : IHistoryService ,
73
+ @INativeWorkbenchEnvironmentService environmentService : INativeWorkbenchEnvironmentService
69
74
) {
70
75
super ( _localPtyService , logService , notificationService , historyService , _configurationResolverService , workspaceContextService ) ;
71
76
77
+
78
+
79
+
80
+ ( async ( ) => {
81
+ // mark('code/willConnectSharedProcess');
82
+ // this.logService.trace('Renderer->SharedProcess#connect: before acquirePort');
83
+ const port = await acquirePort ( 'vscode:createPtyHostMessageChannel' , 'vscode:createPtyHostMessageChannelResult' ) ;
84
+ // mark('code/didConnectSharedProcess');
85
+ // this.logService.trace('Renderer->SharedProcess#connect: connection established');
86
+
87
+ const client = new MessagePortClient ( port , `window:${ environmentService . window . id } ` ) ;
88
+ const proxy = ProxyChannel . toService < IPtyService > ( client . getChannel ( TerminalIpcChannels . PtyHostWindow ) ) ;
89
+
90
+ logService . info ( 'latency: ' , proxy . getLatency ( 0 ) ) ;
91
+ proxy . onProcessData ( e => {
92
+ logService . info ( 'message port process data: ' + e . event ) ;
93
+ } ) ;
94
+ } ) ( ) ;
95
+
96
+
72
97
// Attach process listeners
73
98
this . _localPtyService . onProcessData ( e => this . _ptys . get ( e . id ) ?. handleData ( e . event ) ) ;
74
99
this . _localPtyService . onDidChangeProperty ( e => this . _ptys . get ( e . id ) ?. handleDidChangeProperty ( e . property ) ) ;
0 commit comments