Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
15d15c1f
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,发现更多精彩内容 >>
提交
15d15c1f
编写于
2月 01, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove dynamic marshalling contributions cos they aren't needed anymore
上级
5e36bffc
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
14 addition
and
253 deletion
+14
-253
src/vs/base/common/marshalling.ts
src/vs/base/common/marshalling.ts
+8
-25
src/vs/base/common/remote.ts
src/vs/base/common/remote.ts
+0
-73
src/vs/base/common/worker/workerClient.ts
src/vs/base/common/worker/workerClient.ts
+2
-4
src/vs/base/common/worker/workerServer.ts
src/vs/base/common/worker/workerServer.ts
+2
-4
src/vs/base/test/common/marshalling.test.ts
src/vs/base/test/common/marshalling.test.ts
+0
-50
src/vs/base/test/common/remote.test.ts
src/vs/base/test/common/remote.test.ts
+0
-32
src/vs/platform/plugins/common/ipcRemoteCom.ts
src/vs/platform/plugins/common/ipcRemoteCom.ts
+2
-4
src/vs/platform/thread/common/abstractThreadService.ts
src/vs/platform/thread/common/abstractThreadService.ts
+0
-57
src/vs/platform/thread/common/thread.ts
src/vs/platform/thread/common/thread.ts
+0
-4
未找到文件。
src/vs/base/common/marshalling.ts
浏览文件 @
15d15c1f
...
...
@@ -25,17 +25,12 @@ export function registerMarshallingContribution(contribution:IMarshallingContrib
marshallingContributions
.
push
(
contribution
);
}
var
currentDynamicContrib
:
IMarshallingContribution
=
null
;
export
function
canSerialize
(
obj
:
any
):
boolean
{
for
(
let
contrib
of
marshallingContributions
)
{
if
(
contrib
.
canSerialize
(
obj
))
{
return
true
;
}
}
if
(
currentDynamicContrib
&&
currentDynamicContrib
.
canSerialize
(
obj
))
{
return
true
;
}
}
export
function
serialize
(
obj
:
any
):
any
{
...
...
@@ -47,9 +42,6 @@ export function serialize(obj:any): any {
return
contrib
.
serialize
(
orig
,
serialize
);
}
}
if
(
currentDynamicContrib
&&
currentDynamicContrib
.
canSerialize
(
orig
))
{
return
currentDynamicContrib
.
serialize
(
orig
,
serialize
);
}
}
return
undefined
;
});
...
...
@@ -64,9 +56,6 @@ export function deserialize(obj:any): any {
return
contrib
.
deserialize
(
orig
,
deserialize
);
}
}
if
(
currentDynamicContrib
&&
currentDynamicContrib
.
canDeserialize
(
orig
))
{
return
currentDynamicContrib
.
deserialize
(
orig
,
deserialize
);
}
}
return
undefined
;
});
...
...
@@ -116,24 +105,18 @@ registerMarshallingContribution({
export
function
marshallObject
(
obj
:
any
,
dynamicContrib
:
IMarshallingContribution
=
null
):
string
{
currentDynamicContrib
=
dynamicContrib
;
const
r
=
serialize
(
obj
);
currentDynamicContrib
=
null
;
return
r
;
export
function
marshallObject
(
obj
:
any
):
string
{
return
serialize
(
obj
);
}
export
function
marshallObjectAndStringify
(
obj
:
any
,
dynamicContrib
:
IMarshallingContribution
=
null
):
string
{
return
JSON
.
stringify
(
marshallObject
(
obj
,
dynamicContrib
));
export
function
marshallObjectAndStringify
(
obj
:
any
):
string
{
return
JSON
.
stringify
(
marshallObject
(
obj
));
}
export
function
demarshallObject
(
data
:
any
,
dynamicContrib
:
IMarshallingContribution
=
null
)
{
currentDynamicContrib
=
dynamicContrib
;
const
r
=
deserialize
(
data
);
currentDynamicContrib
=
null
;
return
r
;
export
function
demarshallObject
(
data
:
any
)
{
return
deserialize
(
data
);
}
export
function
parseAndDemarshallObject
(
serialized
:
string
,
dynamicContrib
:
IMarshallingContribution
=
null
):
any
{
return
demarshallObject
(
JSON
.
parse
(
serialized
)
,
dynamicContrib
);
export
function
parseAndDemarshallObject
(
serialized
:
string
):
any
{
return
demarshallObject
(
JSON
.
parse
(
serialized
));
}
\ No newline at end of file
src/vs/base/common/remote.ts
浏览文件 @
15d15c1f
...
...
@@ -38,76 +38,3 @@ function createMethodProxy(remote:IProxyHelper, proxyId: string, path: string):
return
remote
.
callOnRemote
(
proxyId
,
path
,
myArgs
);
};
}
export
interface
IObjDescriptor
{
methods
:
string
[];
props
:
{[
name
:
string
]:
any
;};
}
export
interface
ISerializedProxy
{
$isProxyDescriptor
:
boolean
;
proxyId
:
string
;
desc
:
IObjDescriptor
;
}
export
class
ProxiesMarshallingContribution
implements
IMarshallingContribution
{
private
_remoteCom
:
IProxyHelper
;
constructor
(
remoteCom
:
IProxyHelper
)
{
this
.
_remoteCom
=
remoteCom
;
}
public
canSerialize
(
obj
:
any
):
boolean
{
return
(
typeof
obj
.
$__CREATE__PROXY__REQUEST
===
'
string
'
);
}
public
serialize
(
obj
:
any
,
serialize
:(
obj
:
any
)
=>
any
):
ISerializedProxy
{
var
desc
:
IObjDescriptor
=
{
methods
:
[],
props
:
<
any
>
{}
};
var
keys
=
Object
.
keys
(
obj
);
for
(
var
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
var
key
=
keys
[
i
];
if
(
typeof
obj
[
key
]
===
'
function
'
)
{
desc
.
methods
.
push
(
key
);
}
else
{
desc
.
props
[
key
]
=
serialize
(
obj
[
key
]);
}
}
return
{
$isProxyDescriptor
:
true
,
proxyId
:
obj
.
$__CREATE__PROXY__REQUEST
,
desc
:
desc
};
}
public
canDeserialize
(
obj
:
ISerializedProxy
):
boolean
{
return
obj
.
$isProxyDescriptor
===
true
;
}
public
deserialize
(
obj
:
ISerializedProxy
,
deserialize
:(
obj
:
any
)
=>
any
):
any
{
// this is an object
var
result
:
any
=
{
$__IS_REMOTE_OBJ
:
true
};
var
methods
=
obj
.
desc
.
methods
;
for
(
var
i
=
0
;
i
<
methods
.
length
;
i
++
)
{
result
[
methods
[
i
]]
=
createMethodProxy
(
this
.
_remoteCom
,
obj
.
proxyId
,
methods
[
i
]);
}
var
props
=
obj
.
desc
.
props
;
for
(
var
prop
in
props
)
{
if
(
hasOwnProperty
.
call
(
props
,
prop
))
{
result
[
prop
]
=
deserialize
(
props
[
prop
]);
}
}
return
result
;
}
}
\ No newline at end of file
src/vs/base/common/worker/workerClient.ts
浏览文件 @
15d15c1f
...
...
@@ -49,7 +49,6 @@ export class WorkerClient {
private
_lastTimerEvent
:
timer
.
ITimerEvent
;
private
_remoteCom
:
protocol
.
RemoteCom
;
private
_proxiesMarshalling
:
remote
.
ProxiesMarshallingContribution
;
private
_decodeMessageName
:
(
msg
:
protocol
.
IClientMessage
)
=>
string
;
public
onModuleLoaded
:
TPromise
<
void
>
;
...
...
@@ -92,7 +91,6 @@ export class WorkerClient {
this
.
onModuleLoaded
.
then
(
null
,
()
=>
this
.
_onError
(
'
Worker failed to load
'
+
moduleId
));
this
.
_remoteCom
=
new
protocol
.
RemoteCom
(
this
);
this
.
_proxiesMarshalling
=
new
remote
.
ProxiesMarshallingContribution
(
this
.
_remoteCom
);
}
public
getRemoteCom
():
remote
.
IRemoteCom
{
...
...
@@ -254,13 +252,13 @@ export class WorkerClient {
}
private
_postMessage
(
msg
:
any
):
void
{
this
.
_worker
.
postMessage
(
marshalling
.
marshallObjectAndStringify
(
msg
,
this
.
_proxiesMarshalling
));
this
.
_worker
.
postMessage
(
marshalling
.
marshallObjectAndStringify
(
msg
));
}
private
_onSerializedMessage
(
msg
:
string
):
void
{
var
message
:
protocol
.
IServerMessage
=
null
;
try
{
message
=
marshalling
.
parseAndDemarshallObject
(
msg
,
this
.
_proxiesMarshalling
);
message
=
marshalling
.
parseAndDemarshallObject
(
msg
);
}
catch
(
e
)
{
// nothing
}
...
...
src/vs/base/common/worker/workerServer.ts
浏览文件 @
15d15c1f
...
...
@@ -24,7 +24,6 @@ export class WorkerServer {
private
_lastReq
:
number
;
private
_awaitedReplies
:
{
[
req
:
string
]:
IReplyCallbacks
;
};
private
_remoteCom
:
protocol
.
RemoteCom
;
private
_proxiesMarshalling
:
remote
.
ProxiesMarshallingContribution
;
constructor
(
postSerializedMessage
:(
msg
:
string
)
=>
void
)
{
this
.
_postSerializedMessage
=
postSerializedMessage
;
...
...
@@ -35,7 +34,6 @@ export class WorkerServer {
this
.
_bindConsole
();
this
.
_remoteCom
=
new
protocol
.
RemoteCom
(
this
);
this
.
_proxiesMarshalling
=
new
remote
.
ProxiesMarshallingContribution
(
this
.
_remoteCom
);
}
public
getRemoteCom
():
remote
.
IRemoteCom
{
...
...
@@ -122,11 +120,11 @@ export class WorkerServer {
}
public
onmessage
(
msg
:
string
):
void
{
this
.
_onmessage
(
marshalling
.
parseAndDemarshallObject
(
msg
,
this
.
_proxiesMarshalling
));
this
.
_onmessage
(
marshalling
.
parseAndDemarshallObject
(
msg
));
}
private
_postMessage
(
msg
:
protocol
.
IServerMessage
):
void
{
this
.
_postSerializedMessage
(
marshalling
.
marshallObjectAndStringify
(
msg
,
this
.
_proxiesMarshalling
));
this
.
_postSerializedMessage
(
marshalling
.
marshallObjectAndStringify
(
msg
));
}
private
_onmessage
(
msg
:
protocol
.
IClientMessage
):
void
{
...
...
src/vs/base/test/common/marshalling.test.ts
已删除
100644 → 0
浏览文件 @
5e36bffc
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
IMarshallingContribution
,
marshallObjectAndStringify
,
parseAndDemarshallObject
}
from
'
vs/base/common/marshalling
'
;
class
ObjWithRegExp
{
public
member
:
RegExp
;
constructor
(
something
:
RegExp
)
{
this
.
member
=
something
;
}
}
suite
(
'
Marshalling
'
,
()
=>
{
test
(
'
bug #17587:[plugin] Language plugin can
\'
t define a TokenTypeClassificationSupport#wordDefinition
'
,
()
=>
{
var
simpleMarshallingContrib
:
IMarshallingContribution
=
{
canSerialize
:
(
obj
:
any
)
=>
{
return
obj
instanceof
ObjWithRegExp
;
},
serialize
:
(
obj
:
any
,
serialize
:(
obj
:
any
)
=>
any
)
=>
{
return
{
$ObjWithRegExp
:
true
,
member
:
serialize
(
obj
.
member
)
};
},
canDeserialize
:
(
obj
:
any
)
=>
{
return
(
obj
.
$ObjWithRegExp
===
true
);
},
deserialize
:
(
obj
:
any
,
deserialize
:(
obj
:
any
)
=>
any
)
=>
{
return
new
ObjWithRegExp
(
deserialize
(
obj
.
member
));
}
};
var
initial
=
new
ObjWithRegExp
(
/test/g
);
var
transported
=
<
ObjWithRegExp
>
parseAndDemarshallObject
(
marshallObjectAndStringify
(
initial
,
simpleMarshallingContrib
),
simpleMarshallingContrib
);
assert
(
transported
instanceof
ObjWithRegExp
);
assert
(
transported
.
member
instanceof
RegExp
);
assert
.
equal
(
transported
.
member
.
source
,
'
test
'
);
assert
.
equal
(
transported
.
member
.
global
,
true
);
assert
.
equal
(
transported
.
member
.
ignoreCase
,
false
);
assert
.
equal
(
transported
.
member
.
multiline
,
false
);
});
});
\ No newline at end of file
src/vs/base/test/common/remote.test.ts
已删除
100644 → 0
浏览文件 @
5e36bffc
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
marshallObjectAndStringify
,
parseAndDemarshallObject
}
from
'
vs/base/common/marshalling
'
;
import
{
ProxiesMarshallingContribution
}
from
'
vs/base/common/remote
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
suite
(
'
Remote
'
,
()
=>
{
test
(
'
bug #17587:[plugin] Language plugin can
\'
t define a TokenTypeClassificationSupport#wordDefinition
'
,
()
=>
{
var
contrib
=
new
ProxiesMarshallingContribution
({
callOnRemote
:
()
=>
TPromise
.
as
(
true
)
});
var
initial
=
{
$__CREATE__PROXY__REQUEST
:
'
myId
'
,
member
:
/test/g
};
var
transported
=
parseAndDemarshallObject
(
marshallObjectAndStringify
(
initial
,
contrib
),
contrib
);
assert
.
equal
(
transported
.
$__IS_REMOTE_OBJ
,
true
);
assert
(
transported
.
member
instanceof
RegExp
);
assert
.
equal
(
transported
.
member
.
source
,
'
test
'
);
assert
.
equal
(
transported
.
member
.
global
,
true
);
assert
.
equal
(
transported
.
member
.
ignoreCase
,
false
);
assert
.
equal
(
transported
.
member
.
multiline
,
false
);
});
});
\ No newline at end of file
src/vs/platform/plugins/common/ipcRemoteCom.ts
浏览文件 @
15d15c1f
...
...
@@ -68,7 +68,7 @@ export function create(send: (obj: string) => void): IPluginsIPC {
bigHandler
=
_bigHandler
;
},
handle
:
(
rawmsg
)
=>
{
var
msg
=
marshalling
.
demarshallObject
(
rawmsg
,
proxiesMarshalling
);
var
msg
=
marshalling
.
demarshallObject
(
rawmsg
);
if
(
msg
.
seq
)
{
if
(
!
pendingRPCReplies
.
hasOwnProperty
(
msg
.
seq
))
{
...
...
@@ -132,10 +132,8 @@ export function create(send: (obj: string) => void): IPluginsIPC {
}
};
var
proxiesMarshalling
=
new
remote
.
ProxiesMarshallingContribution
(
r
);
function
marshallAndSend
(
msg
:
any
):
void
{
send
(
marshalling
.
marshallObject
(
msg
,
proxiesMarshalling
));
send
(
marshalling
.
marshallObject
(
msg
));
}
function
invokeHandler
(
rpcId
:
string
,
method
:
string
,
args
:
any
[]):
winjs
.
TPromise
<
any
>
{
...
...
src/vs/platform/thread/common/abstractThreadService.ts
浏览文件 @
15d15c1f
...
...
@@ -163,63 +163,6 @@ export abstract class AbstractThreadService implements remote.IManyHandler {
return
result
;
}
public
createDynamicProxyFromMethods
<
T
>
(
obj
:
T
):
IDynamicProxy
<
T
>
{
let
id
=
AbstractThreadService
.
generateDynamicProxyId
();
let
proxyDefinition
=
this
.
_proxifyMethods
(
id
,
obj
);
return
new
DynamicProxy
(
proxyDefinition
,
()
=>
{
delete
this
.
_localObjMap
[
id
];
});
}
public
createDynamicProxyFromMembers
<
T
>
(
obj
:
T
,
allowedMembers
:
string
[]):
IDynamicProxy
<
T
>
{
let
id
=
AbstractThreadService
.
generateDynamicProxyId
();
let
proxyDefinition
=
this
.
_proxifyMembers
(
id
,
obj
,
allowedMembers
);
return
new
DynamicProxy
(
proxyDefinition
,
()
=>
{
delete
this
.
_localObjMap
[
id
];
});
}
private
_proxifyMethods
<
T
>
(
uniqueIdentifier
:
string
,
obj
:
T
):
T
{
if
(
!
Types
.
isObject
(
obj
))
{
return
null
;
}
this
.
_localObjMap
[
uniqueIdentifier
]
=
obj
;
var
r
:
any
=
{
$__CREATE__PROXY__REQUEST
:
uniqueIdentifier
};
for
(
var
prop
in
obj
)
{
if
(
typeof
obj
[
prop
]
===
'
function
'
)
{
r
[
prop
]
=
obj
[
prop
].
bind
(
obj
);
}
}
return
r
;
}
private
_proxifyMembers
<
T
>
(
uniqueIdentifier
:
string
,
obj
:
T
,
allowedMembers
:
string
[]):
T
{
if
(
!
Types
.
isObject
(
obj
))
{
return
null
;
}
this
.
_localObjMap
[
uniqueIdentifier
]
=
obj
;
var
r
:
any
=
{
$__CREATE__PROXY__REQUEST
:
uniqueIdentifier
};
for
(
var
prop
in
obj
)
{
if
(
allowedMembers
.
indexOf
(
prop
)
===
-
1
)
{
continue
;
}
if
(
typeof
obj
[
prop
]
===
'
function
'
)
{
r
[
prop
]
=
obj
[
prop
].
bind
(
obj
);
}
else
{
r
[
prop
]
=
obj
[
prop
];
}
}
return
r
;
}
public
isProxyObject
<
T
>
(
obj
:
T
):
boolean
{
return
obj
&&
!!
((
<
any
>
obj
).
$__IS_REMOTE_OBJ
);
}
getRemotable
<
T
>
(
ctor
:
instantiation
.
INewConstructorSignature0
<
T
>
):
T
{
var
id
=
Remotable
.
getId
(
ctor
);
if
(
!
id
)
{
...
...
src/vs/platform/thread/common/thread.ts
浏览文件 @
15d15c1f
...
...
@@ -46,10 +46,6 @@ export interface IThreadService {
// --- END deprecated methods
createDynamicProxyFromMethods
<
T
>
(
obj
:
T
):
IDynamicProxy
<
T
>
;
createDynamicProxyFromMembers
<
T
>
(
obj
:
T
,
allowedMembers
:
string
[]):
IDynamicProxy
<
T
>
;
isProxyObject
<
T
>
(
obj
:
T
):
boolean
;
getRemotable
<
T
>
(
ctor
:
instantiation
.
INewConstructorSignature0
<
T
>
):
T
;
registerRemotableInstance
(
ctor
:
any
,
instance
:
any
):
void
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录