Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
489dfec1
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,发现更多精彩内容 >>
提交
489dfec1
编写于
3月 04, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #69141
上级
a1481e3e
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
29 addition
and
43 deletion
+29
-43
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+1
-1
src/vs/platform/instantiation/common/instantiationService.ts
src/vs/platform/instantiation/common/instantiationService.ts
+27
-2
src/vs/platform/instantiation/node/instantiationService.ts
src/vs/platform/instantiation/node/instantiationService.ts
+0
-39
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+1
-1
未找到文件。
src/vs/code/electron-main/main.ts
浏览文件 @
489dfec1
...
...
@@ -16,7 +16,7 @@ import { LifecycleService, ILifecycleService } from 'vs/platform/lifecycle/elect
import
{
Server
,
serve
,
connect
}
from
'
vs/base/parts/ipc/node/ipc.net
'
;
import
{
LaunchChannelClient
}
from
'
vs/platform/launch/electron-main/launchService
'
;
import
{
ServicesAccessor
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
InstantiationService
}
from
'
vs/platform/instantiation/
node
/instantiationService
'
;
import
{
InstantiationService
}
from
'
vs/platform/instantiation/
common
/instantiationService
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
ILogService
,
ConsoleLogMainService
,
MultiplexLogService
,
getLogLevel
}
from
'
vs/platform/log/common/log
'
;
...
...
src/vs/platform/instantiation/common/instantiationService.ts
浏览文件 @
489dfec1
...
...
@@ -9,10 +9,17 @@ import { Graph } from 'vs/platform/instantiation/common/graph';
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
ServiceIdentifier
,
IInstantiationService
,
ServicesAccessor
,
_util
,
optional
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
IdleValue
}
from
'
vs/base/common/async
'
;
// TRACING
const
_enableTracing
=
false
;
// PROXY
// Ghetto-declare of the global Proxy object. This isn't the proper way
// but allows us to run this code in the browser without IE11.
declare
var
Proxy
:
any
;
const
_canUseProxy
=
typeof
Proxy
===
'
function
'
;
export
class
InstantiationService
implements
IInstantiationService
{
_serviceBrand
:
any
;
...
...
@@ -205,8 +212,26 @@ export class InstantiationService implements IInstantiationService {
}
}
protected
_createServiceInstance
<
T
>
(
ctor
:
any
,
args
:
any
[]
=
[],
_supportsDelayedInstantiation
:
boolean
,
_trace
:
Trace
):
T
{
private
_createServiceInstance
<
T
>
(
ctor
:
any
,
args
:
any
[]
=
[],
_supportsDelayedInstantiation
:
boolean
,
_trace
:
Trace
):
T
{
if
(
!
_supportsDelayedInstantiation
||
!
_canUseProxy
)
{
// eager instantiation or no support JS proxies (e.g. IE11)
return
this
.
_createInstance
(
ctor
,
args
,
_trace
);
}
else
{
// Return a proxy object that's backed by an idle value. That
// strategy is to instantiate services in our idle time or when actually
// needed but not when injected into a consumer
const
idle
=
new
IdleValue
(()
=>
this
.
_createInstance
(
ctor
,
args
,
_trace
));
return
<
T
>
new
Proxy
(
Object
.
create
(
null
),
{
get
(
_target
:
T
,
prop
:
PropertyKey
):
any
{
return
idle
.
getValue
()[
prop
];
},
set
(
_target
:
T
,
p
:
PropertyKey
,
value
:
any
):
boolean
{
idle
.
getValue
()[
p
]
=
value
;
return
true
;
}
});
}
}
}
...
...
src/vs/platform/instantiation/node/instantiationService.ts
已删除
100644 → 0
浏览文件 @
a1481e3e
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IdleValue
}
from
'
vs/base/common/async
'
;
import
{
InstantiationService
as
BaseInstantiationService
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
// this is in the /node/-layer because it depends on Proxy which isn't available
// in IE11 and therefore not in the /common/-layer
export
class
InstantiationService
extends
BaseInstantiationService
{
createChild
(
services
:
ServiceCollection
):
IInstantiationService
{
return
new
InstantiationService
(
services
,
this
.
_strict
,
this
);
}
protected
_createServiceInstance
<
T
>
(
ctor
:
any
,
args
:
any
[]
=
[],
supportsDelayedInstantiation
:
boolean
,
_trace
):
T
{
if
(
supportsDelayedInstantiation
)
{
return
InstantiationService
.
_newIdleProxyService
(()
=>
super
.
_createServiceInstance
(
ctor
,
args
,
supportsDelayedInstantiation
,
_trace
));
}
else
{
return
super
.
_createServiceInstance
(
ctor
,
args
,
supportsDelayedInstantiation
,
_trace
);
}
}
private
static
_newIdleProxyService
<
T
>
(
executor
:
()
=>
T
):
T
{
const
idle
=
new
IdleValue
(
executor
);
return
<
T
>
new
Proxy
(
Object
.
create
(
null
),
{
get
(
_target
:
T
,
prop
:
PropertyKey
):
any
{
return
idle
.
getValue
()[
prop
];
},
set
(
_target
:
T
,
p
:
PropertyKey
,
value
:
any
):
boolean
{
idle
.
getValue
()[
p
]
=
value
;
return
true
;
}
});
}
}
src/vs/workbench/electron-browser/main.ts
浏览文件 @
489dfec1
...
...
@@ -47,7 +47,7 @@ import { GlobalStorageDatabaseChannelClient } from 'vs/platform/storage/node/sto
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
InstantiationService
}
from
'
vs/platform/instantiation/
node
/instantiationService
'
;
import
{
InstantiationService
}
from
'
vs/platform/instantiation/
common
/instantiationService
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
registerWindowDriver
}
from
'
vs/platform/driver/electron-browser/driver
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录