Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
9b829cde
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
9b829cde
编写于
11月 21, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #38796
上级
830d5c40
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
33 addition
and
68 deletion
+33
-68
src/vs/base/common/async.ts
src/vs/base/common/async.ts
+19
-13
src/vs/code/electron-main/sharedProcess.ts
src/vs/code/electron-main/sharedProcess.ts
+11
-13
src/vs/workbench/api/node/extHostExtensionService.ts
src/vs/workbench/api/node/extHostExtensionService.ts
+1
-1
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
.../services/extensions/electron-browser/extensionService.ts
+1
-1
src/vs/workbench/services/extensions/node/barrier.ts
src/vs/workbench/services/extensions/node/barrier.ts
+0
-39
src/vs/workbench/services/lifecycle/electron-browser/lifecycleService.ts
...h/services/lifecycle/electron-browser/lifecycleService.ts
+1
-1
未找到文件。
src/vs/base/common/async.ts
浏览文件 @
9b829cde
...
...
@@ -260,29 +260,35 @@ export class ThrottledDelayer<T> extends Delayer<TPromise<T>> {
}
}
export
class
PromiseSource
<
T
>
{
/**
* A barrier that is initially closed and then becomes opened permanently.
*/
export
class
Barrier
{
private
_
value
:
TPromise
<
T
>
;
private
_
completeCallback
:
Function
;
private
_
errorCallback
:
Function
;
private
_
isOpen
:
boolean
;
private
_
promise
:
TPromise
<
boolean
>
;
private
_
completePromise
:
(
v
:
boolean
)
=>
void
;
constructor
()
{
this
.
_value
=
new
TPromise
<
T
>
((
c
,
e
)
=>
{
this
.
_completeCallback
=
c
;
this
.
_errorCallback
=
e
;
this
.
_isOpen
=
false
;
this
.
_promise
=
new
TPromise
<
boolean
>
((
c
,
e
,
p
)
=>
{
this
.
_completePromise
=
c
;
},
()
=>
{
console
.
warn
(
'
You should really not try to cancel this ready promise!
'
);
});
}
get
value
():
TPromise
<
T
>
{
return
this
.
_
value
;
isOpen
():
boolean
{
return
this
.
_
isOpen
;
}
complete
(
value
?:
T
):
void
{
this
.
_completeCallback
(
value
);
open
():
void
{
this
.
_isOpen
=
true
;
this
.
_completePromise
(
true
);
}
error
(
err
?:
any
):
void
{
this
.
_errorCallback
(
err
)
;
wait
():
TPromise
<
boolean
>
{
return
this
.
_promise
;
}
}
...
...
src/vs/code/electron-main/sharedProcess.ts
浏览文件 @
9b829cde
...
...
@@ -10,12 +10,12 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IProcessEnvironment
}
from
'
vs/base/common/platform
'
;
import
{
BrowserWindow
,
ipcMain
}
from
'
electron
'
;
import
{
PromiseSource
}
from
'
vs/base/common/async
'
;
import
{
ISharedProcess
}
from
'
vs/platform/windows/electron-main/windows
'
;
import
{
Barrier
}
from
'
vs/base/common/async
'
;
export
class
SharedProcess
implements
ISharedProcess
{
private
spawnPromiseSource
:
PromiseSource
<
void
>
;
private
barrier
=
new
Barrier
()
;
private
window
:
Electron
.
BrowserWindow
;
private
disposables
:
IDisposable
[]
=
[];
...
...
@@ -79,19 +79,17 @@ export class SharedProcess implements ISharedProcess {
constructor
(
private
environmentService
:
IEnvironmentService
,
private
userEnv
:
IProcessEnvironment
)
{
this
.
spawnPromiseSource
=
new
PromiseSource
<
void
>
();
}
)
{
}
public
spawn
():
void
{
this
.
spawnPromiseSource
.
complete
();
spawn
():
void
{
this
.
barrier
.
open
();
}
public
whenReady
():
TPromise
<
void
>
{
return
this
.
spawnPromiseSource
.
value
.
then
(()
=>
this
.
_whenReady
);
whenReady
():
TPromise
<
void
>
{
return
this
.
barrier
.
wait
()
.
then
(()
=>
this
.
_whenReady
);
}
public
toggle
():
void
{
toggle
():
void
{
if
(
this
.
window
.
isVisible
())
{
this
.
hide
();
}
else
{
...
...
@@ -99,17 +97,17 @@ export class SharedProcess implements ISharedProcess {
}
}
public
show
():
void
{
show
():
void
{
this
.
window
.
show
();
this
.
window
.
webContents
.
openDevTools
();
}
public
hide
():
void
{
hide
():
void
{
this
.
window
.
webContents
.
closeDevTools
();
this
.
window
.
hide
();
}
public
dispose
():
void
{
dispose
():
void
{
this
.
disposables
=
dispose
(
this
.
disposables
);
}
}
src/vs/workbench/api/node/extHostExtensionService.ts
浏览文件 @
9b829cde
...
...
@@ -15,12 +15,12 @@ import { ExtHostStorage } from 'vs/workbench/api/node/extHostStorage';
import
{
createApiFactory
,
initializeExtensionApi
}
from
'
vs/workbench/api/node/extHost.api.impl
'
;
import
{
MainContext
,
MainThreadExtensionServiceShape
,
IWorkspaceData
,
IEnvironment
,
IInitData
,
ExtHostExtensionServiceShape
,
MainThreadTelemetryShape
}
from
'
./extHost.protocol
'
;
import
{
IExtensionMemento
,
ExtensionsActivator
,
ActivatedExtension
,
IExtensionAPI
,
IExtensionContext
,
EmptyExtension
,
IExtensionModule
,
ExtensionActivationTimesBuilder
,
ExtensionActivationTimes
}
from
'
vs/workbench/api/node/extHostExtensionActivator
'
;
import
{
Barrier
}
from
'
vs/workbench/services/extensions/node/barrier
'
;
import
{
ExtHostThreadService
}
from
'
vs/workbench/services/thread/node/extHostThreadService
'
;
import
{
ExtHostConfiguration
}
from
'
vs/workbench/api/node/extHostConfiguration
'
;
import
{
ExtHostWorkspace
}
from
'
vs/workbench/api/node/extHostWorkspace
'
;
import
{
realpath
}
from
'
fs
'
;
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
import
{
Barrier
}
from
'
vs/base/common/async
'
;
class
ExtensionMemento
implements
IExtensionMemento
{
...
...
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
浏览文件 @
9b829cde
...
...
@@ -26,7 +26,6 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ExtensionHostProcessWorker
}
from
'
vs/workbench/services/extensions/electron-browser/extensionHost
'
;
import
{
MainThreadService
}
from
'
vs/workbench/services/thread/electron-browser/threadService
'
;
import
{
Barrier
}
from
'
vs/workbench/services/extensions/node/barrier
'
;
import
{
IMessagePassingProtocol
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
ExtHostCustomersRegistry
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
...
...
@@ -34,6 +33,7 @@ import { Action } from 'vs/base/common/actions';
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
mark
,
time
}
from
'
vs/base/common/performance
'
;
import
{
ILifecycleService
,
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
Barrier
}
from
'
vs/base/common/async
'
;
const
SystemExtensionsRoot
=
path
.
normalize
(
path
.
join
(
URI
.
parse
(
require
.
toUrl
(
''
)).
fsPath
,
'
..
'
,
'
extensions
'
));
...
...
src/vs/workbench/services/extensions/node/barrier.ts
已删除
100644 → 0
浏览文件 @
830d5c40
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
/**
* A barrier that is initially closed and then becomes opened permanently.
*/
export
class
Barrier
{
private
_isOpen
:
boolean
;
private
_promise
:
TPromise
<
boolean
>
;
private
_completePromise
:
(
v
:
boolean
)
=>
void
;
constructor
()
{
this
.
_isOpen
=
false
;
this
.
_promise
=
new
TPromise
<
boolean
>
((
c
,
e
,
p
)
=>
{
this
.
_completePromise
=
c
;
},
()
=>
{
console
.
warn
(
'
You should really not try to cancel this ready promise!
'
);
});
}
public
isOpen
():
boolean
{
return
this
.
_isOpen
;
}
public
open
():
void
{
this
.
_isOpen
=
true
;
this
.
_completePromise
(
true
);
}
public
wait
():
TPromise
<
boolean
>
{
return
this
.
_promise
;
}
}
src/vs/workbench/services/lifecycle/electron-browser/lifecycleService.ts
浏览文件 @
9b829cde
...
...
@@ -14,7 +14,7 @@ import { ipcRenderer as ipc } from 'electron';
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
mark
}
from
'
vs/base/common/performance
'
;
import
{
Barrier
}
from
'
vs/
workbench/services/extensions/node/barrier
'
;
import
{
Barrier
}
from
'
vs/
base/common/async
'
;
export
class
LifecycleService
implements
ILifecycleService
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录