Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bef346d6
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bef346d6
编写于
12月 13, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Have the marshalling kind be a property of the proxy identifier (#36972)
上级
367dd104
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
72 addition
and
89 deletion
+72
-89
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+51
-50
src/vs/workbench/services/extensions/node/proxyIdentifier.ts
src/vs/workbench/services/extensions/node/proxyIdentifier.ts
+20
-18
src/vs/workbench/services/extensions/node/rpcProtocol.ts
src/vs/workbench/services/extensions/node/rpcProtocol.ts
+1
-8
src/vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts
...t/electron-browser/api/extHostDocumentsAndEditors.test.ts
+0
-1
src/vs/workbench/test/electron-browser/api/testThreadService.ts
.../workbench/test/electron-browser/api/testThreadService.ts
+0
-12
未找到文件。
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
bef346d6
...
...
@@ -8,7 +8,8 @@ import {
createMainContextProxyIdentifier
as
createMainId
,
createExtHostContextProxyIdentifier
as
createExtId
,
ProxyIdentifier
,
IRPCProtocol
IRPCProtocol
,
ProxyType
}
from
'
vs/workbench/services/extensions/node/proxyIdentifier
'
;
import
*
as
vscode
from
'
vscode
'
;
...
...
@@ -664,56 +665,56 @@ export interface ExtHostWindowShape {
// --- proxy identifiers
export
const
MainContext
=
{
MainThreadCommands
:
<
ProxyIdentifier
<
MainThreadCommandsShape
>>
createMainId
<
MainThreadCommandsShape
>
(
'
MainThreadCommands
'
),
MainThreadConfiguration
:
createMainId
<
MainThreadConfigurationShape
>
(
'
MainThreadConfiguration
'
),
MainThreadDebugService
:
createMainId
<
MainThreadDebugServiceShape
>
(
'
MainThreadDebugService
'
),
MainThreadDecorations
:
createMainId
<
MainThreadDecorationsShape
>
(
'
MainThreadDecorations
'
),
MainThreadDiagnostics
:
createMainId
<
MainThreadDiagnosticsShape
>
(
'
MainThreadDiagnostics
'
),
MainThreadDialogs
:
createMainId
<
MainThreadDiaglogsShape
>
(
'
MainThreadDiaglogs
'
),
MainThreadDocuments
:
createMainId
<
MainThreadDocumentsShape
>
(
'
MainThreadDocuments
'
),
MainThreadDocumentContentProviders
:
createMainId
<
MainThreadDocumentContentProvidersShape
>
(
'
MainThreadDocumentContentProviders
'
),
MainThreadEditors
:
createMainId
<
MainThreadEditorsShape
>
(
'
MainThreadEditors
'
),
MainThreadErrors
:
createMainId
<
MainThreadErrorsShape
>
(
'
MainThreadErrors
'
),
MainThreadTreeViews
:
createMainId
<
MainThreadTreeViewsShape
>
(
'
MainThreadTreeViews
'
),
MainThreadLanguageFeatures
:
createMainId
<
MainThreadLanguageFeaturesShape
>
(
'
MainThreadLanguageFeatures
'
),
MainThreadLanguages
:
createMainId
<
MainThreadLanguagesShape
>
(
'
MainThreadLanguages
'
),
MainThreadMessageService
:
createMainId
<
MainThreadMessageServiceShape
>
(
'
MainThreadMessageService
'
),
MainThreadOutputService
:
createMainId
<
MainThreadOutputServiceShape
>
(
'
MainThreadOutputService
'
),
MainThreadProgress
:
createMainId
<
MainThreadProgressShape
>
(
'
MainThreadProgress
'
),
MainThreadQuickOpen
:
createMainId
<
MainThreadQuickOpenShape
>
(
'
MainThreadQuickOpen
'
),
MainThreadStatusBar
:
createMainId
<
MainThreadStatusBarShape
>
(
'
MainThreadStatusBar
'
),
MainThreadStorage
:
createMainId
<
MainThreadStorageShape
>
(
'
MainThreadStorage
'
),
MainThreadTelemetry
:
createMainId
<
MainThreadTelemetryShape
>
(
'
MainThreadTelemetry
'
),
MainThreadTerminalService
:
createMainId
<
MainThreadTerminalServiceShape
>
(
'
MainThreadTerminalService
'
),
MainThreadWorkspace
:
createMainId
<
MainThreadWorkspaceShape
>
(
'
MainThreadWorkspace
'
),
MainThreadFileSystem
:
createMainId
<
MainThreadFileSystemShape
>
(
'
MainThreadFileSystem
'
),
MainThreadExtensionService
:
createMainId
<
MainThreadExtensionServiceShape
>
(
'
MainThreadExtensionService
'
),
MainThreadSCM
:
createMainId
<
MainThreadSCMShape
>
(
'
MainThreadSCM
'
),
MainThreadTask
:
createMainId
<
MainThreadTaskShape
>
(
'
MainThreadTask
'
),
MainThreadWindow
:
createMainId
<
MainThreadWindowShape
>
(
'
MainThreadWindow
'
),
MainThreadCommands
:
<
ProxyIdentifier
<
MainThreadCommandsShape
>>
createMainId
<
MainThreadCommandsShape
>
(
'
MainThreadCommands
'
,
ProxyType
.
CustomMarshaller
),
MainThreadConfiguration
:
createMainId
<
MainThreadConfigurationShape
>
(
'
MainThreadConfiguration
'
,
ProxyType
.
CustomMarshaller
),
MainThreadDebugService
:
createMainId
<
MainThreadDebugServiceShape
>
(
'
MainThreadDebugService
'
,
ProxyType
.
CustomMarshaller
),
MainThreadDecorations
:
createMainId
<
MainThreadDecorationsShape
>
(
'
MainThreadDecorations
'
,
ProxyType
.
CustomMarshaller
),
MainThreadDiagnostics
:
createMainId
<
MainThreadDiagnosticsShape
>
(
'
MainThreadDiagnostics
'
,
ProxyType
.
CustomMarshaller
),
MainThreadDialogs
:
createMainId
<
MainThreadDiaglogsShape
>
(
'
MainThreadDiaglogs
'
,
ProxyType
.
CustomMarshaller
),
MainThreadDocuments
:
createMainId
<
MainThreadDocumentsShape
>
(
'
MainThreadDocuments
'
,
ProxyType
.
CustomMarshaller
),
MainThreadDocumentContentProviders
:
createMainId
<
MainThreadDocumentContentProvidersShape
>
(
'
MainThreadDocumentContentProviders
'
,
ProxyType
.
CustomMarshaller
),
MainThreadEditors
:
createMainId
<
MainThreadEditorsShape
>
(
'
MainThreadEditors
'
,
ProxyType
.
CustomMarshaller
),
MainThreadErrors
:
createMainId
<
MainThreadErrorsShape
>
(
'
MainThreadErrors
'
,
ProxyType
.
CustomMarshaller
),
MainThreadTreeViews
:
createMainId
<
MainThreadTreeViewsShape
>
(
'
MainThreadTreeViews
'
,
ProxyType
.
CustomMarshaller
),
MainThreadLanguageFeatures
:
createMainId
<
MainThreadLanguageFeaturesShape
>
(
'
MainThreadLanguageFeatures
'
,
ProxyType
.
CustomMarshaller
),
MainThreadLanguages
:
createMainId
<
MainThreadLanguagesShape
>
(
'
MainThreadLanguages
'
,
ProxyType
.
CustomMarshaller
),
MainThreadMessageService
:
createMainId
<
MainThreadMessageServiceShape
>
(
'
MainThreadMessageService
'
,
ProxyType
.
CustomMarshaller
),
MainThreadOutputService
:
createMainId
<
MainThreadOutputServiceShape
>
(
'
MainThreadOutputService
'
,
ProxyType
.
CustomMarshaller
),
MainThreadProgress
:
createMainId
<
MainThreadProgressShape
>
(
'
MainThreadProgress
'
,
ProxyType
.
CustomMarshaller
),
MainThreadQuickOpen
:
createMainId
<
MainThreadQuickOpenShape
>
(
'
MainThreadQuickOpen
'
,
ProxyType
.
CustomMarshaller
),
MainThreadStatusBar
:
createMainId
<
MainThreadStatusBarShape
>
(
'
MainThreadStatusBar
'
,
ProxyType
.
CustomMarshaller
),
MainThreadStorage
:
createMainId
<
MainThreadStorageShape
>
(
'
MainThreadStorage
'
,
ProxyType
.
CustomMarshaller
),
MainThreadTelemetry
:
createMainId
<
MainThreadTelemetryShape
>
(
'
MainThreadTelemetry
'
,
ProxyType
.
CustomMarshaller
),
MainThreadTerminalService
:
createMainId
<
MainThreadTerminalServiceShape
>
(
'
MainThreadTerminalService
'
,
ProxyType
.
CustomMarshaller
),
MainThreadWorkspace
:
createMainId
<
MainThreadWorkspaceShape
>
(
'
MainThreadWorkspace
'
,
ProxyType
.
CustomMarshaller
),
MainThreadFileSystem
:
createMainId
<
MainThreadFileSystemShape
>
(
'
MainThreadFileSystem
'
,
ProxyType
.
CustomMarshaller
),
MainThreadExtensionService
:
createMainId
<
MainThreadExtensionServiceShape
>
(
'
MainThreadExtensionService
'
,
ProxyType
.
CustomMarshaller
),
MainThreadSCM
:
createMainId
<
MainThreadSCMShape
>
(
'
MainThreadSCM
'
,
ProxyType
.
CustomMarshaller
),
MainThreadTask
:
createMainId
<
MainThreadTaskShape
>
(
'
MainThreadTask
'
,
ProxyType
.
CustomMarshaller
),
MainThreadWindow
:
createMainId
<
MainThreadWindowShape
>
(
'
MainThreadWindow
'
,
ProxyType
.
CustomMarshaller
),
};
export
const
ExtHostContext
=
{
ExtHostCommands
:
createExtId
<
ExtHostCommandsShape
>
(
'
ExtHostCommands
'
),
ExtHostConfiguration
:
createExtId
<
ExtHostConfigurationShape
>
(
'
ExtHostConfiguration
'
),
ExtHostDiagnostics
:
createExtId
<
ExtHostDiagnosticsShape
>
(
'
ExtHostDiagnostics
'
),
ExtHostDebugService
:
createExtId
<
ExtHostDebugServiceShape
>
(
'
ExtHostDebugService
'
),
ExtHostDecorations
:
createExtId
<
ExtHostDecorationsShape
>
(
'
ExtHostDecorations
'
),
ExtHostDocumentsAndEditors
:
createExtId
<
ExtHostDocumentsAndEditorsShape
>
(
'
ExtHostDocumentsAndEditors
'
),
ExtHostDocuments
:
createExtId
<
ExtHostDocumentsShape
>
(
'
ExtHostDocuments
'
),
ExtHostDocumentContentProviders
:
createExtId
<
ExtHostDocumentContentProvidersShape
>
(
'
ExtHostDocumentContentProviders
'
),
ExtHostDocumentSaveParticipant
:
createExtId
<
ExtHostDocumentSaveParticipantShape
>
(
'
ExtHostDocumentSaveParticipant
'
),
ExtHostEditors
:
createExtId
<
ExtHostEditorsShape
>
(
'
ExtHostEditors
'
),
ExtHostTreeViews
:
createExtId
<
ExtHostTreeViewsShape
>
(
'
ExtHostTreeViews
'
),
ExtHostFileSystem
:
createExtId
<
ExtHostFileSystemShape
>
(
'
ExtHostFileSystem
'
),
ExtHostFileSystemEventService
:
createExtId
<
ExtHostFileSystemEventServiceShape
>
(
'
ExtHostFileSystemEventService
'
),
ExtHostHeapService
:
createExtId
<
ExtHostHeapServiceShape
>
(
'
ExtHostHeapMonitor
'
),
ExtHostLanguageFeatures
:
createExtId
<
ExtHostLanguageFeaturesShape
>
(
'
ExtHostLanguageFeatures
'
),
ExtHostQuickOpen
:
createExtId
<
ExtHostQuickOpenShape
>
(
'
ExtHostQuickOpen
'
),
ExtHostExtensionService
:
createExtId
<
ExtHostExtensionServiceShape
>
(
'
ExtHostExtensionService
'
),
ExtHostTerminalService
:
createExtId
<
ExtHostTerminalServiceShape
>
(
'
ExtHostTerminalService
'
),
ExtHostSCM
:
createExtId
<
ExtHostSCMShape
>
(
'
ExtHostSCM
'
),
ExtHostTask
:
createExtId
<
ExtHostTaskShape
>
(
'
ExtHostTask
'
),
ExtHostWorkspace
:
createExtId
<
ExtHostWorkspaceShape
>
(
'
ExtHostWorkspace
'
),
ExtHostWindow
:
createExtId
<
ExtHostWindowShape
>
(
'
ExtHostWindow
'
),
ExtHostCommands
:
createExtId
<
ExtHostCommandsShape
>
(
'
ExtHostCommands
'
,
ProxyType
.
CustomMarshaller
),
ExtHostConfiguration
:
createExtId
<
ExtHostConfigurationShape
>
(
'
ExtHostConfiguration
'
,
ProxyType
.
CustomMarshaller
),
ExtHostDiagnostics
:
createExtId
<
ExtHostDiagnosticsShape
>
(
'
ExtHostDiagnostics
'
,
ProxyType
.
CustomMarshaller
),
ExtHostDebugService
:
createExtId
<
ExtHostDebugServiceShape
>
(
'
ExtHostDebugService
'
,
ProxyType
.
CustomMarshaller
),
ExtHostDecorations
:
createExtId
<
ExtHostDecorationsShape
>
(
'
ExtHostDecorations
'
,
ProxyType
.
CustomMarshaller
),
ExtHostDocumentsAndEditors
:
createExtId
<
ExtHostDocumentsAndEditorsShape
>
(
'
ExtHostDocumentsAndEditors
'
,
ProxyType
.
CustomMarshaller
),
ExtHostDocuments
:
createExtId
<
ExtHostDocumentsShape
>
(
'
ExtHostDocuments
'
,
ProxyType
.
CustomMarshaller
),
ExtHostDocumentContentProviders
:
createExtId
<
ExtHostDocumentContentProvidersShape
>
(
'
ExtHostDocumentContentProviders
'
,
ProxyType
.
CustomMarshaller
),
ExtHostDocumentSaveParticipant
:
createExtId
<
ExtHostDocumentSaveParticipantShape
>
(
'
ExtHostDocumentSaveParticipant
'
,
ProxyType
.
CustomMarshaller
),
ExtHostEditors
:
createExtId
<
ExtHostEditorsShape
>
(
'
ExtHostEditors
'
,
ProxyType
.
CustomMarshaller
),
ExtHostTreeViews
:
createExtId
<
ExtHostTreeViewsShape
>
(
'
ExtHostTreeViews
'
,
ProxyType
.
CustomMarshaller
),
ExtHostFileSystem
:
createExtId
<
ExtHostFileSystemShape
>
(
'
ExtHostFileSystem
'
,
ProxyType
.
CustomMarshaller
),
ExtHostFileSystemEventService
:
createExtId
<
ExtHostFileSystemEventServiceShape
>
(
'
ExtHostFileSystemEventService
'
,
ProxyType
.
CustomMarshaller
),
ExtHostHeapService
:
createExtId
<
ExtHostHeapServiceShape
>
(
'
ExtHostHeapMonitor
'
,
ProxyType
.
CustomMarshaller
),
ExtHostLanguageFeatures
:
createExtId
<
ExtHostLanguageFeaturesShape
>
(
'
ExtHostLanguageFeatures
'
,
ProxyType
.
CustomMarshaller
),
ExtHostQuickOpen
:
createExtId
<
ExtHostQuickOpenShape
>
(
'
ExtHostQuickOpen
'
,
ProxyType
.
CustomMarshaller
),
ExtHostExtensionService
:
createExtId
<
ExtHostExtensionServiceShape
>
(
'
ExtHostExtensionService
'
,
ProxyType
.
CustomMarshaller
),
ExtHostTerminalService
:
createExtId
<
ExtHostTerminalServiceShape
>
(
'
ExtHostTerminalService
'
,
ProxyType
.
CustomMarshaller
),
ExtHostSCM
:
createExtId
<
ExtHostSCMShape
>
(
'
ExtHostSCM
'
,
ProxyType
.
CustomMarshaller
),
ExtHostTask
:
createExtId
<
ExtHostTaskShape
>
(
'
ExtHostTask
'
,
ProxyType
.
CustomMarshaller
),
ExtHostWorkspace
:
createExtId
<
ExtHostWorkspaceShape
>
(
'
ExtHostWorkspace
'
,
ProxyType
.
CustomMarshaller
),
ExtHostWindow
:
createExtId
<
ExtHostWindowShape
>
(
'
ExtHostWindow
'
,
ProxyType
.
CustomMarshaller
),
};
src/vs/workbench/services/extensions/node/proxyIdentifier.ts
浏览文件 @
bef346d6
...
...
@@ -6,20 +6,10 @@
export
interface
IRPCProtocol
{
/**
* Returns a proxy to an object addressable/named in the extension host process.
* > **Note:** Arguments or results of type `URI` or `RegExp` will be serialized/deserialized automatically,
* > but this has a performance cost, as each argument/result must be visited.
* >
* > Use `getFast` for a proxy where such arguments are not automatically serialized/deserialized.
* Returns a proxy to an object addressable/named in the extension host process or in the renderer process.
*/
getProxy
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
;
/**
* Returns a proxy to an object addressable/named in the extension host process.
* > **Note:** Arguments or results of type `URI` or `RegExp` will **not** be serialized/deserialized automatically.
*/
getFastProxy
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
;
/**
* Register manually created instance.
*/
...
...
@@ -35,19 +25,31 @@ export class ProxyIdentifier<T> {
_proxyIdentifierBrand
:
void
;
_suppressCompilerUnusedWarning
:
T
;
isMain
:
boolean
;
id
:
string
;
public
readonly
isMain
:
boolean
;
public
readonly
id
:
string
;
public
readonly
isFancy
:
boolean
;
constructor
(
isMain
:
boolean
,
id
:
string
)
{
constructor
(
isMain
:
boolean
,
id
:
string
,
isFancy
:
boolean
)
{
this
.
isMain
=
isMain
;
this
.
id
=
id
;
this
.
isFancy
=
isFancy
;
}
}
export
function
createMainContextProxyIdentifier
<
T
>
(
identifier
:
string
):
ProxyIdentifier
<
T
>
{
return
new
ProxyIdentifier
(
true
,
'
m
'
+
identifier
);
export
const
enum
ProxyType
{
NativeJSON
=
0
,
CustomMarshaller
=
1
}
/**
* Using `isFancy` indicates that arguments or results of type `URI` or `RegExp`
* will be serialized/deserialized automatically, but this has a performance cost,
* as each argument/result must be visited.
*/
export
function
createMainContextProxyIdentifier
<
T
>
(
identifier
:
string
,
type
:
ProxyType
=
ProxyType
.
NativeJSON
):
ProxyIdentifier
<
T
>
{
return
new
ProxyIdentifier
(
true
,
'
m
'
+
identifier
,
type
===
ProxyType
.
CustomMarshaller
);
}
export
function
createExtHostContextProxyIdentifier
<
T
>
(
identifier
:
string
):
ProxyIdentifier
<
T
>
{
return
new
ProxyIdentifier
(
false
,
'
e
'
+
identifier
);
export
function
createExtHostContextProxyIdentifier
<
T
>
(
identifier
:
string
,
type
:
ProxyType
=
ProxyType
.
NativeJSON
):
ProxyIdentifier
<
T
>
{
return
new
ProxyIdentifier
(
false
,
'
e
'
+
identifier
,
type
===
ProxyType
.
CustomMarshaller
);
}
src/vs/workbench/services/extensions/node/rpcProtocol.ts
浏览文件 @
bef346d6
...
...
@@ -46,14 +46,7 @@ export class RPCProtocol implements IRPCProtocol {
public
getProxy
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
{
if
(
!
this
.
_proxies
[
identifier
.
id
])
{
this
.
_proxies
[
identifier
.
id
]
=
this
.
_createProxy
(
identifier
.
id
,
true
);
}
return
this
.
_proxies
[
identifier
.
id
];
}
public
getFastProxy
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
{
if
(
!
this
.
_proxies
[
identifier
.
id
])
{
this
.
_proxies
[
identifier
.
id
]
=
this
.
_createProxy
(
identifier
.
id
,
false
);
this
.
_proxies
[
identifier
.
id
]
=
this
.
_createProxy
(
identifier
.
id
,
identifier
.
isFancy
);
}
return
this
.
_proxies
[
identifier
.
id
];
}
...
...
src/vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts
浏览文件 @
bef346d6
...
...
@@ -16,7 +16,6 @@ suite('ExtHostDocumentsAndEditors', () => {
setup
(
function
()
{
editors
=
new
ExtHostDocumentsAndEditors
({
getProxy
:
()
=>
{
return
undefined
;
},
getFastProxy
:
()
=>
{
return
undefined
;
},
set
:
undefined
,
assertRegistered
:
undefined
});
...
...
src/vs/workbench/test/electron-browser/api/testThreadService.ts
浏览文件 @
bef346d6
...
...
@@ -13,9 +13,6 @@ export function OneGetThreadService(thing: any): IRPCProtocol {
getProxy
<
T
>
():
T
{
return
thing
;
},
getFastProxy
<
T
>
():
T
{
return
thing
;
},
set
<
T
,
R
extends
T
>
(
identifier
:
ProxyIdentifier
<
T
>
,
value
:
R
):
R
{
return
value
;
},
...
...
@@ -124,15 +121,6 @@ export class TestThreadService extends AbstractTestThreadService implements IRPC
}
getProxy
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
{
return
this
.
_get
(
identifier
);
}
getFastProxy
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
{
return
this
.
_get
(
identifier
);
}
_get
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
{
let
id
=
identifier
.
id
;
if
(
this
.
_locals
[
id
])
{
return
this
.
_locals
[
id
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录