Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
d536410f
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,发现更多精彩内容 >>
提交
d536410f
编写于
1月 24, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
extension report cache and load
上级
d14d66d1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
62 addition
and
14 deletion
+62
-14
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+1
-1
src/vs/platform/extensionManagement/common/extensionManagementIpc.ts
...form/extensionManagement/common/extensionManagementIpc.ts
+7
-1
src/vs/platform/extensionManagement/node/extensionGalleryService.ts
...tform/extensionManagement/node/extensionGalleryService.ts
+0
-6
src/vs/platform/extensionManagement/node/extensionManagementService.ts
...rm/extensionManagement/node/extensionManagementService.ts
+54
-6
未找到文件。
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
d536410f
...
...
@@ -232,7 +232,6 @@ export enum StatisticType {
export
interface
IReportedExtension
{
id
:
IExtensionIdentifier
;
malicious
:
boolean
;
slow
:
boolean
;
}
export
interface
IExtensionGalleryService
{
...
...
@@ -280,6 +279,7 @@ export interface IExtensionManagementService {
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
void
>
;
uninstall
(
extension
:
ILocalExtension
,
force
?:
boolean
):
TPromise
<
void
>
;
getInstalled
(
type
?:
LocalExtensionType
):
TPromise
<
ILocalExtension
[]
>
;
getExtensionsReport
():
TPromise
<
IReportedExtension
[]
>
;
updateMetadata
(
local
:
ILocalExtension
,
metadata
:
IGalleryMetadata
):
TPromise
<
ILocalExtension
>
;
}
...
...
src/vs/platform/extensionManagement/common/extensionManagementIpc.ts
浏览文件 @
d536410f
...
...
@@ -7,7 +7,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IChannel
,
eventToCall
,
eventFromCall
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IExtensionManagementService
,
ILocalExtension
,
InstallExtensionEvent
,
DidInstallExtensionEvent
,
IGalleryExtension
,
LocalExtensionType
,
DidUninstallExtensionEvent
,
IExtensionIdentifier
,
IGalleryMetadata
}
from
'
./extensionManagement
'
;
import
{
IExtensionManagementService
,
ILocalExtension
,
InstallExtensionEvent
,
DidInstallExtensionEvent
,
IGalleryExtension
,
LocalExtensionType
,
DidUninstallExtensionEvent
,
IExtensionIdentifier
,
IGalleryMetadata
,
IReportedExtension
}
from
'
./extensionManagement
'
;
import
Event
,
{
buffer
}
from
'
vs/base/common/event
'
;
export
interface
IExtensionManagementChannel
extends
IChannel
{
...
...
@@ -19,6 +19,7 @@ export interface IExtensionManagementChannel extends IChannel {
call
(
command
:
'
installFromGallery
'
,
extension
:
IGalleryExtension
):
TPromise
<
void
>
;
call
(
command
:
'
uninstall
'
,
args
:
[
ILocalExtension
,
boolean
]):
TPromise
<
void
>
;
call
(
command
:
'
getInstalled
'
):
TPromise
<
ILocalExtension
[]
>
;
call
(
command
:
'
getExtensionsReport
'
):
TPromise
<
IReportedExtension
[]
>
;
call
(
command
:
string
,
arg
?:
any
):
TPromise
<
any
>
;
}
...
...
@@ -47,6 +48,7 @@ export class ExtensionManagementChannel implements IExtensionManagementChannel {
case
'
uninstall
'
:
return
this
.
service
.
uninstall
(
arg
[
0
],
arg
[
1
]);
case
'
getInstalled
'
:
return
this
.
service
.
getInstalled
(
arg
);
case
'
updateMetadata
'
:
return
this
.
service
.
updateMetadata
(
arg
[
0
],
arg
[
1
]);
case
'
getExtensionsReport
'
:
return
this
.
service
.
getExtensionsReport
();
}
return
undefined
;
}
...
...
@@ -89,4 +91,8 @@ export class ExtensionManagementChannelClient implements IExtensionManagementSer
updateMetadata
(
local
:
ILocalExtension
,
metadata
:
IGalleryMetadata
):
TPromise
<
ILocalExtension
>
{
return
this
.
channel
.
call
(
'
updateMetadata
'
,
[
local
,
metadata
]);
}
getExtensionsReport
():
TPromise
<
IReportedExtension
[]
>
{
return
this
.
channel
.
call
(
'
getExtensionsReport
'
);
}
}
\ No newline at end of file
src/vs/platform/extensionManagement/node/extensionGalleryService.ts
浏览文件 @
d536410f
...
...
@@ -743,12 +743,6 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
map
.
set
(
id
,
ext
);
}
for
(
const
id
of
result
.
slow
)
{
const
ext
=
map
.
get
(
id
)
||
{
id
:
{
id
},
malicious
:
false
,
slow
:
true
};
ext
.
slow
=
true
;
map
.
set
(
id
,
ext
);
}
return
TPromise
.
as
(
values
(
map
));
});
});
...
...
src/vs/platform/extensionManagement/node/extensionManagementService.ts
浏览文件 @
d536410f
...
...
@@ -19,7 +19,8 @@ import {
IGalleryExtension
,
IExtensionManifest
,
IGalleryMetadata
,
InstallExtensionEvent
,
DidInstallExtensionEvent
,
DidUninstallExtensionEvent
,
LocalExtensionType
,
StatisticType
,
IExtensionIdentifier
IExtensionIdentifier
,
IReportedExtension
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
getGalleryExtensionIdFromLocal
,
adoptToGalleryExtensionId
,
areSameExtensions
,
getGalleryExtensionId
,
groupByExtension
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
localizeManifest
}
from
'
../common/extensionNls
'
;
...
...
@@ -103,8 +104,9 @@ export class ExtensionManagementService implements IExtensionManagementService {
private
extensionsPath
:
string
;
private
uninstalledPath
:
string
;
private
userData
Path
:
string
;
private
reported
Path
:
string
;
private
uninstalledFileLimiter
:
Limiter
<
void
>
;
private
reportedExtensions
:
TPromise
<
IReportedExtension
[]
>
;
private
disposables
:
IDisposable
[]
=
[];
private
readonly
_onInstallExtension
=
new
Emitter
<
InstallExtensionEvent
>
();
...
...
@@ -122,20 +124,24 @@ export class ExtensionManagementService implements IExtensionManagementService {
onDidUninstallExtension
:
Event
<
DidUninstallExtensionEvent
>
=
this
.
_onDidUninstallExtension
.
event
;
constructor
(
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IChoiceService
private
choiceService
:
IChoiceService
,
@
IExtensionGalleryService
private
galleryService
:
IExtensionGalleryService
,
@
ILogService
private
logService
:
ILogService
,
@
ILogService
private
logService
:
ILogService
)
{
this
.
extensionsPath
=
environmentService
.
extensionsPath
;
this
.
uninstalledPath
=
path
.
join
(
this
.
extensionsPath
,
'
.obsolete
'
);
this
.
userDataPath
=
environmentService
.
userDataPath
;
this
.
uninstalledFileLimiter
=
new
Limiter
(
1
);
this
.
disposables
.
push
(
toDisposable
(()
=>
this
.
installingExtensions
.
clear
()));
this
.
reportedPath
=
path
.
join
(
this
.
extensionsPath
,
'
.reported
'
);
this
.
reportedExtensions
=
this
.
loadReportFromCache
();
setTimeout
(()
=>
this
.
loopRefreshReportCache
(),
1000
*
10
);
// 10 seconds after boot
}
private
deleteExtensionsManifestCache
():
void
{
const
cacheFolder
=
path
.
join
(
this
.
userDataPath
,
MANIFEST_CACHE_FOLDER
);
const
cacheFolder
=
path
.
join
(
this
.
environmentService
.
userDataPath
,
MANIFEST_CACHE_FOLDER
);
const
cacheFile
=
path
.
join
(
cacheFolder
,
USER_MANIFEST_CACHE_FILE
);
pfs
.
del
(
cacheFile
).
done
(()
=>
{
},
()
=>
{
});
...
...
@@ -776,6 +782,48 @@ export class ExtensionManagementService implements IExtensionManagementService {
});
}
getExtensionsReport
():
TPromise
<
IReportedExtension
[]
>
{
return
this
.
reportedExtensions
;
}
private
loadReportFromCache
():
TPromise
<
IReportedExtension
[]
>
{
this
.
logService
.
trace
(
'
ExtensionManagementService.loadReportedFromCache
'
);
return
pfs
.
readFile
(
this
.
reportedPath
,
'
utf8
'
)
.
then
(
raw
=>
JSON
.
parse
(
raw
))
.
then
(
result
=>
{
this
.
logService
.
trace
(
`ExtensionManagementService.loadReportedFromCache - loaded
${
result
.
length
}
reported extensions from cache`
);
return
result
;
},
()
=>
{
this
.
logService
.
trace
(
`ExtensionManagementService.loadReportedFromCache - no cache found`
);
});
}
private
loopRefreshReportCache
():
void
{
this
.
refreshReportCache
()
.
then
(()
=>
TPromise
.
timeout
(
1000
*
60
*
5
))
// every five minutes
.
then
(()
=>
this
.
loopRefreshReportCache
());
}
private
refreshReportCache
():
TPromise
<
any
>
{
this
.
logService
.
trace
(
'
ExtensionManagementService.refreshReportedCache
'
);
return
this
.
reportedExtensions
=
this
.
galleryService
.
getExtensionsReport
()
.
then
(
null
,
err
=>
{
this
.
logService
.
trace
(
'
ExtensionManagementService.refreshReportedCache - failed to get extension report
'
);
return
[];
})
.
then
(
result
=>
{
this
.
logService
.
trace
(
`ExtensionManagementService.refreshReportedCache - got
${
result
.
length
}
reported extensions from service`
);
return
pfs
.
writeFile
(
this
.
reportedPath
,
JSON
.
stringify
(
result
))
.
then
(()
=>
result
,
err
=>
{
this
.
logService
.
trace
(
'
ExtensionManagementService.refreshReportedCache - failed to cache extension report
'
);
return
result
;
});
});
}
dispose
()
{
this
.
disposables
=
dispose
(
this
.
disposables
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录