Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
97f01b33
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,发现更多精彩内容 >>
未验证
提交
97f01b33
编写于
11月 25, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move profiling related state down from `AbstractRuntimeExtensionsEditor`
上级
ba867135
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
66 addition
and
39 deletion
+66
-39
src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts
...ib/extensions/electron-browser/runtimeExtensionsEditor.ts
+66
-39
未找到文件。
src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts
浏览文件 @
97f01b33
...
...
@@ -95,11 +95,8 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
public
static
readonly
ID
:
string
=
'
workbench.editor.runtimeExtensions
'
;
private
_list
:
WorkbenchList
<
IRuntimeExtension
>
|
null
;
private
_profileInfo
:
IExtensionHostProfile
|
null
;
private
_elements
:
IRuntimeExtension
[]
|
null
;
private
_updateSoon
:
RunOnceScheduler
;
private
_profileSessionState
:
IContextKey
<
string
>
;
private
_extensionsHostRecorded
:
IContextKey
<
boolean
>
;
constructor
(
@
ITelemetryService
telemetryService
:
ITelemetryService
,
...
...
@@ -110,7 +107,6 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
@
INotificationService
private
readonly
_notificationService
:
INotificationService
,
@
IContextMenuService
private
readonly
_contextMenuService
:
IContextMenuService
,
@
IInstantiationService
protected
readonly
_instantiationService
:
IInstantiationService
,
@
IExtensionHostProfileService
private
readonly
_extensionHostProfileService
:
IExtensionHostProfileService
,
@
IStorageService
storageService
:
IStorageService
,
@
ILabelService
private
readonly
_labelService
:
ILabelService
,
@
IWorkbenchEnvironmentService
private
readonly
_environmentService
:
IWorkbenchEnvironmentService
,
...
...
@@ -118,27 +114,14 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
super
(
RuntimeExtensionsEditor
.
ID
,
telemetryService
,
themeService
,
storageService
);
this
.
_list
=
null
;
this
.
_profileInfo
=
this
.
_extensionHostProfileService
.
lastProfile
;
this
.
_elements
=
null
;
this
.
_updateSoon
=
this
.
_register
(
new
RunOnceScheduler
(()
=>
this
.
_updateExtensions
(),
200
));
this
.
_profileSessionState
=
CONTEXT_PROFILE_SESSION_STATE
.
bindTo
(
contextKeyService
);
this
.
_extensionsHostRecorded
=
CONTEXT_EXTENSION_HOST_PROFILE_RECORDED
.
bindTo
(
contextKeyService
);
this
.
_register
(
this
.
_extensionHostProfileService
.
onDidChangeLastProfile
(()
=>
{
this
.
_profileInfo
=
this
.
_extensionHostProfileService
.
lastProfile
;
this
.
_extensionsHostRecorded
.
set
(
!!
this
.
_profileInfo
);
this
.
_updateExtensions
();
}));
this
.
_register
(
this
.
_extensionHostProfileService
.
onDidChangeState
(()
=>
{
const
state
=
this
.
_extensionHostProfileService
.
state
;
this
.
_profileSessionState
.
set
(
ProfileSessionState
[
state
].
toLowerCase
());
}));
this
.
_register
(
this
.
_extensionService
.
onDidChangeExtensionsStatus
(()
=>
this
.
_updateSoon
.
schedule
()));
this
.
_updateExtensions
();
}
pr
ivate
async
_updateExtensions
():
Promise
<
void
>
{
pr
otected
async
_updateExtensions
():
Promise
<
void
>
{
this
.
_elements
=
await
this
.
_resolveExtensions
();
if
(
this
.
_list
)
{
this
.
_list
.
splice
(
0
,
this
.
_list
.
length
,
this
.
_elements
);
...
...
@@ -161,11 +144,12 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
// group profile segments by extension
let
segments
:
{
[
id
:
string
]:
number
[];
}
=
Object
.
create
(
null
);
if
(
this
.
_profileInfo
)
{
let
currentStartTime
=
this
.
_profileInfo
.
startTime
;
for
(
let
i
=
0
,
len
=
this
.
_profileInfo
.
deltas
.
length
;
i
<
len
;
i
++
)
{
const
id
=
this
.
_profileInfo
.
ids
[
i
];
const
delta
=
this
.
_profileInfo
.
deltas
[
i
];
const
profileInfo
=
this
.
_getProfileInfo
();
if
(
profileInfo
)
{
let
currentStartTime
=
profileInfo
.
startTime
;
for
(
let
i
=
0
,
len
=
profileInfo
.
deltas
.
length
;
i
<
len
;
i
++
)
{
const
id
=
profileInfo
.
ids
[
i
];
const
delta
=
profileInfo
.
deltas
[
i
];
let
extensionSegments
=
segments
[
ExtensionIdentifier
.
toKey
(
id
)];
if
(
!
extensionSegments
)
{
...
...
@@ -184,7 +168,7 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
const
extensionDescription
=
extensionsDescriptions
[
i
];
let
profileInfo
:
IExtensionProfileInformation
|
null
=
null
;
if
(
this
.
_
profileInfo
)
{
if
(
profileInfo
)
{
let
extensionSegments
=
segments
[
ExtensionIdentifier
.
toKey
(
extensionDescription
.
identifier
)]
||
[];
let
extensionTotalTime
=
0
;
for
(
let
j
=
0
,
lenJ
=
extensionSegments
.
length
/
2
;
j
<
lenJ
;
j
++
)
{
...
...
@@ -204,7 +188,7 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
marketplaceInfo
:
marketplaceMap
[
ExtensionIdentifier
.
toKey
(
extensionDescription
.
identifier
)],
status
:
statusMap
[
extensionDescription
.
identifier
.
value
],
profileInfo
:
profileInfo
||
undefined
,
unresponsiveProfile
:
this
.
_
extensionHostProfileService
.
getUnresponsiveProfile
(
extensionDescription
.
identifier
)
unresponsiveProfile
:
this
.
_getUnresponsiveProfile
(
extensionDescription
.
identifier
)
};
}
...
...
@@ -213,7 +197,7 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
// bubble up extensions that have caused slowness
const
isUnresponsive
=
(
extension
:
IRuntimeExtension
):
boolean
=>
extension
.
unresponsiveProfile
===
this
.
_
profileInfo
;
extension
.
unresponsiveProfile
===
profileInfo
;
const
profileTime
=
(
extension
:
IRuntimeExtension
):
number
=>
extension
.
profileInfo
?.
totalTime
??
0
;
...
...
@@ -391,7 +375,7 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
clearNode
(
data
.
msgContainer
);
if
(
this
.
_
extensionHostProfileService
.
getUnresponsiveProfile
(
element
.
description
.
identifier
))
{
if
(
this
.
_getUnresponsiveProfile
(
element
.
description
.
identifier
))
{
const
el
=
$
(
'
span
'
,
undefined
,
...
renderCodicons
(
` $(alert) Unresponsive`
));
el
.
title
=
nls
.
localize
(
'
unresponsive.title
'
,
"
Extension has caused the extension host to freeze.
"
);
data
.
msgContainer
.
appendChild
(
el
);
...
...
@@ -417,7 +401,7 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
}
}
if
(
this
.
_profileInfo
&&
element
.
profileInfo
)
{
if
(
element
.
profileInfo
)
{
data
.
profileTime
.
textContent
=
`Profile:
${(
element
.
profileInfo
.
totalTime
/
1000
).
toFixed
(
2
)}
ms`
;
}
else
{
data
.
profileTime
.
textContent
=
''
;
...
...
@@ -468,8 +452,7 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
actions
.
push
(
new
Action
(
'
runtimeExtensionsEditor.action.disable
'
,
nls
.
localize
(
'
disable
'
,
"
Disable
"
),
undefined
,
true
,
()
=>
this
.
_extensionsWorkbenchService
.
setEnablement
(
e
.
element
!
.
marketplaceInfo
,
EnablementState
.
DisabledGlobally
)));
actions
.
push
(
new
Separator
());
const
state
=
this
.
_extensionHostProfileService
.
state
;
const
profileAction
=
(
state
===
ProfileSessionState
.
Running
?
this
.
_createStopExtensionHostProfileAction
()
:
this
.
_createStartExtensionHostProfileAction
());
const
profileAction
=
this
.
_createProfileAction
();
if
(
profileAction
)
{
actions
.
push
(
profileAction
);
}
...
...
@@ -496,15 +479,58 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
}
}
protected
abstract
_getProfileInfo
():
IExtensionHostProfile
|
null
;
protected
abstract
_getUnresponsiveProfile
(
extensionId
:
ExtensionIdentifier
):
IExtensionHostProfile
|
undefined
;
protected
abstract
_createSlowExtensionAction
(
element
:
IRuntimeExtension
):
Action
|
null
;
protected
abstract
_createReportExtensionIssueAction
(
element
:
IRuntimeExtension
):
Action
|
null
;
protected
abstract
_createSaveExtensionHostProfileAction
():
Action
|
null
;
protected
abstract
_createStartExtensionHostProfileAction
():
Action
|
null
;
protected
abstract
_createStopExtensionHostProfileAction
():
Action
|
null
;
protected
abstract
_createProfileAction
():
Action
|
null
;
}
export
class
RuntimeExtensionsEditor
extends
AbstractRuntimeExtensionsEditor
{
private
_profileInfo
:
IExtensionHostProfile
|
null
;
private
_extensionsHostRecorded
:
IContextKey
<
boolean
>
;
private
_profileSessionState
:
IContextKey
<
string
>
;
constructor
(
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IThemeService
themeService
:
IThemeService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IExtensionsWorkbenchService
extensionsWorkbenchService
:
IExtensionsWorkbenchService
,
@
IExtensionService
extensionService
:
IExtensionService
,
@
INotificationService
notificationService
:
INotificationService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IStorageService
storageService
:
IStorageService
,
@
ILabelService
labelService
:
ILabelService
,
@
IWorkbenchEnvironmentService
environmentService
:
IWorkbenchEnvironmentService
,
@
IExtensionHostProfileService
private
readonly
_extensionHostProfileService
:
IExtensionHostProfileService
,
)
{
super
(
telemetryService
,
themeService
,
contextKeyService
,
extensionsWorkbenchService
,
extensionService
,
notificationService
,
contextMenuService
,
instantiationService
,
storageService
,
labelService
,
environmentService
);
this
.
_profileInfo
=
this
.
_extensionHostProfileService
.
lastProfile
;
this
.
_extensionsHostRecorded
=
CONTEXT_EXTENSION_HOST_PROFILE_RECORDED
.
bindTo
(
contextKeyService
);
this
.
_profileSessionState
=
CONTEXT_PROFILE_SESSION_STATE
.
bindTo
(
contextKeyService
);
this
.
_register
(
this
.
_extensionHostProfileService
.
onDidChangeLastProfile
(()
=>
{
this
.
_profileInfo
=
this
.
_extensionHostProfileService
.
lastProfile
;
this
.
_extensionsHostRecorded
.
set
(
!!
this
.
_profileInfo
);
this
.
_updateExtensions
();
}));
this
.
_register
(
this
.
_extensionHostProfileService
.
onDidChangeState
(()
=>
{
const
state
=
this
.
_extensionHostProfileService
.
state
;
this
.
_profileSessionState
.
set
(
ProfileSessionState
[
state
].
toLowerCase
());
}));
}
protected
_getProfileInfo
():
IExtensionHostProfile
|
null
{
return
this
.
_profileInfo
;
}
protected
_getUnresponsiveProfile
(
extensionId
:
ExtensionIdentifier
):
IExtensionHostProfile
|
undefined
{
return
this
.
_extensionHostProfileService
.
getUnresponsiveProfile
(
extensionId
);
}
protected
_createSlowExtensionAction
(
element
:
IRuntimeExtension
):
Action
|
null
{
if
(
element
.
unresponsiveProfile
)
{
return
this
.
_instantiationService
.
createInstance
(
SlowExtensionAction
,
element
.
description
,
element
.
unresponsiveProfile
);
...
...
@@ -520,14 +546,15 @@ export class RuntimeExtensionsEditor extends AbstractRuntimeExtensionsEditor {
return
this
.
_instantiationService
.
createInstance
(
SaveExtensionHostProfileAction
,
SaveExtensionHostProfileAction
.
ID
,
SaveExtensionHostProfileAction
.
LABEL
);
}
protected
_createStartExtensionHostProfileAction
():
Action
|
null
{
return
this
.
_instantiationService
.
createInstance
(
StartExtensionHostProfileAction
,
StartExtensionHostProfileAction
.
ID
,
StartExtensionHostProfileAction
.
LABEL
);
protected
_createProfileAction
():
Action
|
null
{
const
state
=
this
.
_extensionHostProfileService
.
state
;
const
profileAction
=
(
state
===
ProfileSessionState
.
Running
?
this
.
_instantiationService
.
createInstance
(
StopExtensionHostProfileAction
,
StopExtensionHostProfileAction
.
ID
,
StopExtensionHostProfileAction
.
LABEL
)
:
this
.
_instantiationService
.
createInstance
(
StartExtensionHostProfileAction
,
StartExtensionHostProfileAction
.
ID
,
StartExtensionHostProfileAction
.
LABEL
)
);
return
profileAction
;
}
protected
_createStopExtensionHostProfileAction
():
Action
|
null
{
return
this
.
_instantiationService
.
createInstance
(
StopExtensionHostProfileAction
,
StopExtensionHostProfileAction
.
ID
,
StopExtensionHostProfileAction
.
LABEL
);
}
}
export
class
ShowRuntimeExtensionsAction
extends
Action
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录