Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
旅途_2012
vscode
提交
0f8d80a7
V
vscode
项目概览
旅途_2012
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0f8d80a7
编写于
4月 11, 2019
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove support for Buffer
上级
fd8b829e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
57 deletion
+8
-57
src/vs/workbench/services/extensions/common/rpcProtocol.ts
src/vs/workbench/services/extensions/common/rpcProtocol.ts
+8
-57
未找到文件。
src/vs/workbench/services/extensions/common/rpcProtocol.ts
浏览文件 @
0f8d80a7
...
...
@@ -258,11 +258,6 @@ export class RPCProtocol extends Disposable implements IRPCProtocol {
this
.
_receiveReply
(
msgLength
,
req
,
value
);
break
;
}
case
MessageType
.
ReplyOKBuffer
:
{
let
value
=
MessageIO
.
deserializeReplyOKBuffer
(
buff
);
this
.
_receiveReply
(
msgLength
,
req
,
value
);
break
;
}
case
MessageType
.
ReplyOKVSBuffer
:
{
let
value
=
MessageIO
.
deserializeReplyOKVSBuffer
(
buff
);
this
.
_receiveReply
(
msgLength
,
req
,
value
);
...
...
@@ -517,21 +512,11 @@ class MessageBuffer {
return
str
;
}
public
static
sizeBuffer
(
buff
:
VSBuffer
):
number
{
return
4
/* buffer length */
+
buff
.
byteLength
/* actual buffer */
;
}
public
writeBuffer
(
buff
:
VSBuffer
):
void
{
this
.
_buff
.
writeUint32BE
(
buff
.
byteLength
,
this
.
_offset
);
this
.
_offset
+=
4
;
this
.
_buff
.
set
(
buff
,
this
.
_offset
);
this
.
_offset
+=
buff
.
byteLength
;
}
public
readBuffer
():
Buffer
{
const
buffLength
=
this
.
_buff
.
readUint32BE
(
this
.
_offset
);
this
.
_offset
+=
4
;
const
buff
=
this
.
_buff
.
slice
(
this
.
_offset
,
this
.
_offset
+
buffLength
);
this
.
_offset
+=
buffLength
;
return
<
Buffer
>
buff
.
buffer
;
}
public
static
sizeVSBuffer
(
buff
:
VSBuffer
):
number
{
return
4
/* buffer length */
+
buff
.
byteLength
/* actual buffer */
;
}
...
...
@@ -556,8 +541,6 @@ class MessageBuffer {
size
+=
1
;
// arg type
if
(
elType
===
ArgType
.
String
)
{
size
+=
this
.
sizeLongString
(
el
);
}
else
if
(
elType
===
ArgType
.
Buffer
)
{
size
+=
this
.
sizeBuffer
(
el
);
}
else
{
size
+=
this
.
sizeVSBuffer
(
el
);
}
...
...
@@ -573,9 +556,6 @@ class MessageBuffer {
if
(
elType
===
ArgType
.
String
)
{
this
.
writeUInt8
(
ArgType
.
String
);
this
.
writeLongString
(
el
);
}
else
if
(
elType
===
ArgType
.
Buffer
)
{
this
.
writeUInt8
(
ArgType
.
Buffer
);
this
.
writeVSBuffer
(
el
);
}
else
{
this
.
writeUInt8
(
ArgType
.
VSBuffer
);
this
.
writeVSBuffer
(
el
);
...
...
@@ -583,18 +563,15 @@ class MessageBuffer {
}
}
public
readMixedArray
():
Array
<
string
|
Buffer
|
VSBuffer
>
{
public
readMixedArray
():
Array
<
string
|
VSBuffer
>
{
const
arrLen
=
this
.
_buff
.
readUint8
(
this
.
_offset
);
this
.
_offset
+=
1
;
let
arr
:
Array
<
string
|
Buffer
|
VSBuffer
>
=
new
Array
(
arrLen
);
let
arr
:
Array
<
string
|
VSBuffer
>
=
new
Array
(
arrLen
);
for
(
let
i
=
0
;
i
<
arrLen
;
i
++
)
{
const
argType
=
<
ArgType
>
this
.
readUInt8
();
switch
(
argType
)
{
case
ArgType
.
String
:
arr
[
i
]
=
this
.
readLongString
();
break
;
case
ArgType
.
Buffer
:
arr
[
i
]
=
this
.
readBuffer
();
break
;
case
ArgType
.
VSBuffer
:
arr
[
i
]
=
this
.
readVSBuffer
();
break
;
...
...
@@ -608,9 +585,6 @@ class MessageIO {
private
static
_arrayContainsBuffer
(
arr
:
any
[]):
boolean
{
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
if
(
Buffer
.
isBuffer
(
arr
[
i
]))
{
return
true
;
}
if
(
arr
[
i
]
instanceof
VSBuffer
)
{
return
true
;
}
...
...
@@ -624,10 +598,7 @@ class MessageIO {
let
massagedArgsType
:
ArgType
[]
=
[];
for
(
let
i
=
0
,
len
=
args
.
length
;
i
<
len
;
i
++
)
{
const
arg
=
args
[
i
];
if
(
Buffer
.
isBuffer
(
arg
))
{
massagedArgs
[
i
]
=
VSBuffer
.
wrap
(
arg
);
massagedArgsType
[
i
]
=
ArgType
.
Buffer
;
}
else
if
(
arg
instanceof
VSBuffer
)
{
if
(
arg
instanceof
VSBuffer
)
{
massagedArgs
[
i
]
=
arg
;
massagedArgsType
[
i
]
=
ArgType
.
VSBuffer
;
}
else
{
...
...
@@ -714,9 +685,6 @@ class MessageIO {
if
(
typeof
res
===
'
undefined
'
)
{
return
this
.
_serializeReplyOKEmpty
(
req
);
}
if
(
Buffer
.
isBuffer
(
res
))
{
return
this
.
_serializeReplyOKBuffer
(
req
,
res
);
}
if
(
res
instanceof
VSBuffer
)
{
return
this
.
_serializeReplyOKVSBuffer
(
req
,
res
);
}
...
...
@@ -727,17 +695,6 @@ class MessageIO {
return
MessageBuffer
.
alloc
(
MessageType
.
ReplyOKEmpty
,
req
,
0
).
buffer
;
}
private
static
_serializeReplyOKBuffer
(
req
:
number
,
res
:
Buffer
):
VSBuffer
{
const
buff
=
VSBuffer
.
wrap
(
res
);
let
len
=
0
;
len
+=
MessageBuffer
.
sizeBuffer
(
buff
);
let
result
=
MessageBuffer
.
alloc
(
MessageType
.
ReplyOKBuffer
,
req
,
len
);
result
.
writeBuffer
(
buff
);
return
result
.
buffer
;
}
private
static
_serializeReplyOKVSBuffer
(
req
:
number
,
res
:
VSBuffer
):
VSBuffer
{
let
len
=
0
;
len
+=
MessageBuffer
.
sizeVSBuffer
(
res
);
...
...
@@ -747,10 +704,6 @@ class MessageIO {
return
result
.
buffer
;
}
public
static
deserializeReplyOKBuffer
(
buff
:
MessageBuffer
):
Buffer
{
return
buff
.
readBuffer
();
}
public
static
deserializeReplyOKVSBuffer
(
buff
:
MessageBuffer
):
VSBuffer
{
return
buff
.
readVSBuffer
();
}
...
...
@@ -807,15 +760,13 @@ const enum MessageType {
Acknowledged
=
5
,
Cancel
=
6
,
ReplyOKEmpty
=
7
,
ReplyOKBuffer
=
8
,
ReplyOKVSBuffer
=
9
,
ReplyOKJSON
=
10
,
ReplyErrError
=
11
,
ReplyErrEmpty
=
12
,
ReplyOKVSBuffer
=
8
,
ReplyOKJSON
=
9
,
ReplyErrError
=
10
,
ReplyErrEmpty
=
11
,
}
const
enum
ArgType
{
String
=
1
,
Buffer
=
2
,
VSBuffer
=
3
VSBuffer
=
2
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录