Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
f73c1139
V
vscode
项目概览
掘金者说
/
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,发现更多精彩内容 >>
提交
f73c1139
编写于
4月 12, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use more ExtensionHostProfiler and less extension service
上级
5f03e036
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
43 deletion
+13
-43
src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts
...ib/extensions/electron-browser/extensionProfileService.ts
+4
-2
src/vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler.ts
...rib/extensions/electron-browser/extensionsAutoProfiler.ts
+6
-3
src/vs/workbench/services/extensions/common/extensions.ts
src/vs/workbench/services/extensions/common/extensions.ts
+2
-13
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
.../services/extensions/electron-browser/extensionService.ts
+1
-25
未找到文件。
src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts
浏览文件 @
f73c1139
...
...
@@ -21,6 +21,7 @@ import { randomPort } from 'vs/base/node/ports';
import
product
from
'
vs/platform/product/node/product
'
;
import
{
RuntimeExtensionsInput
}
from
'
vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsInput
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ExtensionHostProfiler
}
from
'
vs/workbench/services/extensions/electron-browser/extensionHostProfiler
'
;
export
class
ExtensionHostProfileService
extends
Disposable
implements
IExtensionHostProfileService
{
...
...
@@ -76,7 +77,8 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
return
null
;
}
if
(
!
this
.
_extensionService
.
canProfileExtensionHost
())
{
const
inspectPort
=
this
.
_extensionService
.
getInspectPort
();
if
(
!
inspectPort
)
{
return
this
.
_dialogService
.
confirm
({
type
:
'
info
'
,
message
:
nls
.
localize
(
'
restart1
'
,
"
Profile Extensions
"
),
...
...
@@ -92,7 +94,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
this
.
_setState
(
ProfileSessionState
.
Starting
);
return
this
.
_
extensionService
.
startExtensionHostProfile
().
then
((
value
)
=>
{
return
this
.
_
instantiationService
.
createInstance
(
ExtensionHostProfiler
,
inspectPort
).
start
().
then
((
value
)
=>
{
this
.
_profileSession
=
value
;
this
.
_setState
(
ProfileSessionState
.
Running
);
},
(
err
)
=>
{
...
...
src/vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler.ts
浏览文件 @
f73c1139
...
...
@@ -21,6 +21,7 @@ import { RuntimeExtensionsInput } from 'vs/workbench/contrib/extensions/electron
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
createSlowExtensionAction
}
from
'
vs/workbench/contrib/extensions/electron-browser/extensionsSlowActions
'
;
import
{
ExtensionHostProfiler
}
from
'
vs/workbench/services/extensions/electron-browser/extensionHostProfiler
'
;
export
class
ExtensionsAutoProfiler
extends
Disposable
implements
IWorkbenchContribution
{
...
...
@@ -41,9 +42,10 @@ export class ExtensionsAutoProfiler extends Disposable implements IWorkbenchCont
}
private
async
_onDidChangeResponsiveChange
(
event
:
IResponsiveStateChangeEvent
):
Promise
<
void
>
{
const
target
=
this
.
_extensionService
;
if
(
!
target
.
canProfileExtensionHost
())
{
const
port
=
this
.
_extensionService
.
getInspectPort
();
if
(
!
port
)
{
return
;
}
...
...
@@ -59,7 +61,8 @@ export class ExtensionsAutoProfiler extends Disposable implements IWorkbenchCont
let
session
:
ProfileSession
;
try
{
session
=
await
target
.
startExtensionHostProfile
();
session
=
await
this
.
_instantiationService
.
createInstance
(
ExtensionHostProfiler
,
port
).
start
();
}
catch
(
err
)
{
this
.
_session
=
undefined
;
// fail silent as this is often
...
...
src/vs/workbench/services/extensions/common/extensions.ts
浏览文件 @
f73c1139
...
...
@@ -208,20 +208,11 @@ export interface IExtensionService {
getExtensionsStatus
():
{
[
id
:
string
]:
IExtensionsStatus
};
/**
* Return the inspect port or 0.
* Return the inspect port or `0`, the latter means inspection
* is not possible.
*/
getInspectPort
():
number
;
/**
* Can the extension host be profiled.
*/
canProfileExtensionHost
():
boolean
;
/**
*
*/
startExtensionHostProfile
():
Promise
<
ProfileSession
>
;
/**
* Restarts the extension host.
*/
...
...
@@ -282,9 +273,7 @@ export class NullExtensionService implements IExtensionService {
getExtension
()
{
return
Promise
.
resolve
(
undefined
);
}
readExtensionPointContributions
<
T
>
(
_extPoint
:
IExtensionPoint
<
T
>
):
Promise
<
ExtensionPointContribution
<
T
>
[]
>
{
return
Promise
.
resolve
(
Object
.
create
(
null
));
}
getExtensionsStatus
():
{
[
id
:
string
]:
IExtensionsStatus
;
}
{
return
Object
.
create
(
null
);
}
canProfileExtensionHost
():
boolean
{
return
false
;
}
getInspectPort
():
number
{
return
0
;
}
startExtensionHostProfile
():
Promise
<
ProfileSession
>
{
return
Promise
.
resolve
(
Object
.
create
(
null
));
}
restartExtensionHost
():
void
{
}
startExtensionHost
():
void
{
}
stopExtensionHost
():
void
{
}
...
...
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
浏览文件 @
f73c1139
...
...
@@ -23,7 +23,7 @@ import product from 'vs/platform/product/node/product';
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWindowService
,
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
ActivationTimes
,
ExtensionPointContribution
,
IExtensionService
,
IExtensionsStatus
,
IMessage
,
ProfileSession
,
IWillActivateEvent
,
IResponsiveStateChangeEvent
,
toExtension
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ActivationTimes
,
ExtensionPointContribution
,
IExtensionService
,
IExtensionsStatus
,
IMessage
,
IWillActivateEvent
,
IResponsiveStateChangeEvent
,
toExtension
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ExtensionMessageCollector
,
ExtensionPoint
,
ExtensionsRegistry
,
IExtensionPoint
,
IExtensionPointUser
,
schema
}
from
'
vs/workbench/services/extensions/common/extensionsRegistry
'
;
import
{
ExtensionHostProcessWorker
}
from
'
vs/workbench/services/extensions/electron-browser/extensionHost
'
;
import
{
ExtensionDescriptionRegistry
}
from
'
vs/workbench/services/extensions/common/extensionDescriptionRegistry
'
;
...
...
@@ -35,7 +35,6 @@ import { Schemas } from 'vs/base/common/network';
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
parseExtensionDevOptions
}
from
'
vs/workbench/services/extensions/common/extensionDevOptions
'
;
import
{
ExtensionHostProfiler
}
from
'
vs/workbench/services/extensions/electron-browser/extensionHostProfiler
'
;
const
hasOwnProperty
=
Object
.
hasOwnProperty
;
const
NO_OP_VOID_PROMISE
=
Promise
.
resolve
<
void
>
(
undefined
);
...
...
@@ -570,29 +569,6 @@ export class ExtensionService extends Disposable implements IExtensionService {
return
result
;
}
public
canProfileExtensionHost
():
boolean
{
for
(
let
i
=
0
,
len
=
this
.
_extensionHostProcessManagers
.
length
;
i
<
len
;
i
++
)
{
const
extHostProcessManager
=
this
.
_extensionHostProcessManagers
[
i
];
if
(
extHostProcessManager
.
canProfileExtensionHost
())
{
return
true
;
}
}
return
false
;
}
public
startExtensionHostProfile
():
Promise
<
ProfileSession
>
{
for
(
let
i
=
0
,
len
=
this
.
_extensionHostProcessManagers
.
length
;
i
<
len
;
i
++
)
{
const
extHostProcessManager
=
this
.
_extensionHostProcessManagers
[
i
];
if
(
extHostProcessManager
.
canProfileExtensionHost
())
{
const
port
=
extHostProcessManager
.
getInspectPort
();
if
(
port
)
{
return
this
.
_instantiationService
.
createInstance
(
ExtensionHostProfiler
,
port
).
start
();
}
}
}
throw
new
Error
(
'
Extension host not running or no inspect port available
'
);
}
public
getInspectPort
():
number
{
if
(
this
.
_extensionHostProcessManagers
.
length
>
0
)
{
return
this
.
_extensionHostProcessManagers
[
0
].
getInspectPort
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录