Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bfe8ff1d
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,发现更多精彩内容 >>
未验证
提交
bfe8ff1d
编写于
6月 28, 2018
作者:
J
Johannes Rieken
提交者:
GitHub
6月 28, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #53226 from Microsoft/joh/isLatest
IUpdateService#isLatestVersion
上级
949e2193
e723431e
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
56 addition
and
26 deletion
+56
-26
src/vs/platform/update/common/update.ts
src/vs/platform/update/common/update.ts
+3
-1
src/vs/platform/update/common/updateIpc.ts
src/vs/platform/update/common/updateIpc.ts
+7
-1
src/vs/platform/update/electron-main/abstractUpdateService.ts
...vs/platform/update/electron-main/abstractUpdateService.ts
+23
-3
src/vs/platform/update/electron-main/updateService.darwin.ts
src/vs/platform/update/electron-main/updateService.darwin.ts
+8
-6
src/vs/platform/update/electron-main/updateService.linux.ts
src/vs/platform/update/electron-main/updateService.linux.ts
+4
-7
src/vs/platform/update/electron-main/updateService.win32.ts
src/vs/platform/update/electron-main/updateService.win32.ts
+5
-7
src/vs/workbench/parts/performance/electron-browser/startupTimings.ts
...ench/parts/performance/electron-browser/startupTimings.ts
+6
-1
未找到文件。
src/vs/platform/update/common/update.ts
浏览文件 @
bfe8ff1d
...
...
@@ -89,4 +89,6 @@ export interface IUpdateService {
downloadUpdate
():
TPromise
<
void
>
;
applyUpdate
():
TPromise
<
void
>
;
quitAndInstall
():
TPromise
<
void
>
;
isLatestVersion
():
TPromise
<
boolean
|
undefined
>
;
}
src/vs/platform/update/common/updateIpc.ts
浏览文件 @
bfe8ff1d
...
...
@@ -17,6 +17,7 @@ export interface IUpdateChannel extends IChannel {
call
(
command
:
'
applyUpdate
'
):
TPromise
<
void
>
;
call
(
command
:
'
quitAndInstall
'
):
TPromise
<
void
>
;
call
(
command
:
'
_getInitialState
'
):
TPromise
<
State
>
;
call
(
command
:
'
isLatestVersion
'
):
TPromise
<
boolean
>
;
call
(
command
:
string
,
arg
?:
any
):
TPromise
<
any
>
;
}
...
...
@@ -32,6 +33,7 @@ export class UpdateChannel implements IUpdateChannel {
case
'
applyUpdate
'
:
return
this
.
service
.
applyUpdate
();
case
'
quitAndInstall
'
:
return
this
.
service
.
quitAndInstall
();
case
'
_getInitialState
'
:
return
TPromise
.
as
(
this
.
service
.
state
);
case
'
isLatestVersion
'
:
return
this
.
service
.
isLatestVersion
();
}
return
undefined
;
}
...
...
@@ -77,4 +79,8 @@ export class UpdateChannelClient implements IUpdateService {
quitAndInstall
():
TPromise
<
void
>
{
return
this
.
channel
.
call
(
'
quitAndInstall
'
);
}
isLatestVersion
():
TPromise
<
boolean
>
{
return
this
.
channel
.
call
(
'
isLatestVersion
'
);
}
}
src/vs/platform/update/electron-main/abstractUpdateService.ts
浏览文件 @
bfe8ff1d
...
...
@@ -14,6 +14,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
IUpdateService
,
State
,
StateType
,
AvailableForDownload
}
from
'
vs/platform/update/common/update
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IRequestService
}
from
'
vs/platform/request/node/request
'
;
export
function
createUpdateURL
(
platform
:
string
,
quality
:
string
):
string
{
return
`
${
product
.
updateUrl
}
/api/update/
${
platform
}
/
${
quality
}
/
${
product
.
commit
}
`
;
...
...
@@ -23,6 +24,8 @@ export abstract class AbstractUpdateService implements IUpdateService {
_serviceBrand
:
any
;
protected
readonly
url
:
string
|
undefined
;
private
_state
:
State
=
State
.
Uninitialized
;
private
throttler
:
Throttler
=
new
Throttler
();
...
...
@@ -43,7 +46,8 @@ export abstract class AbstractUpdateService implements IUpdateService {
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
@
IConfigurationService
protected
configurationService
:
IConfigurationService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
ILogService
protected
logService
:
ILogService
@
IRequestService
protected
requestService
:
IRequestService
,
@
ILogService
protected
logService
:
ILogService
,
)
{
if
(
this
.
environmentService
.
disableUpdates
)
{
this
.
logService
.
info
(
'
update#ctor - updates are disabled
'
);
...
...
@@ -62,7 +66,8 @@ export abstract class AbstractUpdateService implements IUpdateService {
return
;
}
if
(
!
this
.
setUpdateFeedUrl
(
quality
))
{
this
.
url
=
this
.
buildUpdateFeedUrl
(
quality
);
if
(
!
this
.
url
)
{
this
.
logService
.
info
(
'
update#ctor - updates are disabled
'
);
return
;
}
...
...
@@ -153,10 +158,25 @@ export abstract class AbstractUpdateService implements IUpdateService {
return
TPromise
.
as
(
null
);
}
isLatestVersion
():
TPromise
<
boolean
|
undefined
>
{
if
(
!
this
.
url
)
{
return
TPromise
.
as
(
undefined
);
}
return
this
.
requestService
.
request
({
url
:
this
.
url
}).
then
(
context
=>
{
// The update server replies with 204 (No Content) when no
// update is available - that's all we want to know.
if
(
context
.
res
.
statusCode
===
204
)
{
return
true
;
}
else
{
return
false
;
}
});
}
protected
doQuitAndInstall
():
void
{
// noop
}
protected
abstract
setUpdateFeedUrl
(
quality
:
string
):
boolean
;
protected
abstract
buildUpdateFeedUrl
(
quality
:
string
):
string
|
undefined
;
protected
abstract
doCheckForUpdates
(
context
:
any
):
void
;
}
src/vs/platform/update/electron-main/updateService.darwin.ts
浏览文件 @
bfe8ff1d
...
...
@@ -16,6 +16,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
AbstractUpdateService
,
createUpdateURL
}
from
'
vs/platform/update/electron-main/abstractUpdateService
'
;
import
{
IRequestService
}
from
'
vs/platform/request/node/request
'
;
export
class
DarwinUpdateService
extends
AbstractUpdateService
{
...
...
@@ -33,9 +34,10 @@ export class DarwinUpdateService extends AbstractUpdateService {
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IRequestService
requestService
:
IRequestService
,
@
ILogService
logService
:
ILogService
)
{
super
(
lifecycleService
,
configurationService
,
environmentService
,
logService
);
super
(
lifecycleService
,
configurationService
,
environmentService
,
requestService
,
logService
);
this
.
onRawError
(
this
.
onError
,
this
,
this
.
disposables
);
this
.
onRawUpdateAvailable
(
this
.
onUpdateAvailable
,
this
,
this
.
disposables
);
this
.
onRawUpdateDownloaded
(
this
.
onUpdateDownloaded
,
this
,
this
.
disposables
);
...
...
@@ -47,16 +49,16 @@ export class DarwinUpdateService extends AbstractUpdateService {
this
.
setState
(
State
.
Idle
);
}
protected
setUpdateFeedUrl
(
quality
:
string
):
boolean
{
protected
buildUpdateFeedUrl
(
quality
:
string
):
string
|
undefined
{
const
url
=
createUpdateURL
(
'
darwin
'
,
quality
);
try
{
electron
.
autoUpdater
.
setFeedURL
(
createUpdateURL
(
'
darwin
'
,
quality
)
);
electron
.
autoUpdater
.
setFeedURL
(
url
);
}
catch
(
e
)
{
// application is very likely not signed
this
.
logService
.
error
(
'
Failed to set update feed URL
'
,
e
);
return
false
;
return
undefined
;
}
return
true
;
return
url
;
}
protected
doCheckForUpdates
(
context
:
any
):
void
{
...
...
src/vs/platform/update/electron-main/updateService.linux.ts
浏览文件 @
bfe8ff1d
...
...
@@ -22,22 +22,19 @@ export class LinuxUpdateService extends AbstractUpdateService {
_serviceBrand
:
any
;
private
url
:
string
|
undefined
;
constructor
(
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IRequestService
private
requestService
:
IRequestService
,
@
IRequestService
requestService
:
IRequestService
,
@
ILogService
logService
:
ILogService
)
{
super
(
lifecycleService
,
configurationService
,
environmentService
,
logService
);
super
(
lifecycleService
,
configurationService
,
environmentService
,
requestService
,
logService
);
}
protected
setUpdateFeedUrl
(
quality
:
string
):
boolean
{
this
.
url
=
createUpdateURL
(
`linux-
${
process
.
arch
}
`
,
quality
);
return
true
;
protected
buildUpdateFeedUrl
(
quality
:
string
):
string
{
return
createUpdateURL
(
`linux-
${
process
.
arch
}
`
,
quality
);
}
protected
doCheckForUpdates
(
context
:
any
):
void
{
...
...
src/vs/platform/update/electron-main/updateService.win32.ts
浏览文件 @
bfe8ff1d
...
...
@@ -47,7 +47,6 @@ export class Win32UpdateService extends AbstractUpdateService {
_serviceBrand
:
any
;
private
url
:
string
|
undefined
;
private
availableUpdate
:
IAvailableUpdate
|
undefined
;
@
memoize
...
...
@@ -61,15 +60,15 @@ export class Win32UpdateService extends AbstractUpdateService {
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IRequestService
private
requestService
:
IRequestService
,
@
IRequestService
requestService
:
IRequestService
,
@
ILogService
logService
:
ILogService
)
{
super
(
lifecycleService
,
configurationService
,
environmentService
,
logService
);
super
(
lifecycleService
,
configurationService
,
environmentService
,
requestService
,
logService
);
}
protected
setUpdateFeedUrl
(
quality
:
string
):
boolean
{
protected
buildUpdateFeedUrl
(
quality
:
string
):
string
|
undefined
{
if
(
!
fs
.
existsSync
(
path
.
join
(
path
.
dirname
(
process
.
execPath
),
'
unins000.exe
'
)))
{
return
false
;
return
undefined
;
}
let
platform
=
'
win32
'
;
...
...
@@ -82,8 +81,7 @@ export class Win32UpdateService extends AbstractUpdateService {
platform
+=
'
-user
'
;
}
this
.
url
=
createUpdateURL
(
platform
,
quality
);
return
true
;
return
createUpdateURL
(
platform
,
quality
);
}
protected
doCheckForUpdates
(
context
:
any
):
void
{
...
...
src/vs/workbench/parts/performance/electron-browser/startupTimings.ts
浏览文件 @
bfe8ff1d
...
...
@@ -21,6 +21,7 @@ import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
import
{
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IUpdateService
}
from
'
vs/platform/update/common/update
'
;
class
StartupTimings
implements
IWorkbenchContribution
{
...
...
@@ -34,6 +35,7 @@ class StartupTimings implements IWorkbenchContribution {
@
ITelemetryService
private
readonly
_telemetryService
:
ITelemetryService
,
@
ILifecycleService
private
readonly
_lifecycleService
:
ILifecycleService
,
@
IExtensionService
private
readonly
_extensionService
:
IExtensionService
,
@
IUpdateService
private
readonly
_updateService
:
IUpdateService
,
)
{
this
.
_reportVariedStartupTimes
().
then
(
undefined
,
onUnexpectedError
);
...
...
@@ -87,7 +89,10 @@ class StartupTimings implements IWorkbenchContribution {
this
.
_logService
.
info
(
'
no standard startup: not using cached data
'
);
return
;
}
if
(
!
await
this
.
_updateService
.
isLatestVersion
())
{
this
.
_logService
.
info
(
'
no standard startup: not running latest version
'
);
return
;
}
// wait only know so that can check the restored state as soon as possible
await
TPromise
.
join
([
this
.
_extensionService
.
whenInstalledExtensionsRegistered
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录