Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ffbc4885
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,体验更适合开发者的 AI 搜索 >>
提交
ffbc4885
编写于
10月 05, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - add whenClosedOrLoaded into window class
上级
86a42393
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
32 deletion
+34
-32
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+26
-1
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+1
-26
src/vs/platform/launch/electron-main/launchMainService.ts
src/vs/platform/launch/electron-main/launchMainService.ts
+1
-1
src/vs/platform/windows/electron-main/windows.ts
src/vs/platform/windows/electron-main/windows.ts
+6
-4
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
ffbc4885
...
...
@@ -70,6 +70,9 @@ export class CodeWindow extends Disposable implements ICodeWindow {
private
readonly
_onDestroy
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onDestroy
:
CommonEvent
<
void
>
=
this
.
_onDestroy
.
event
;
private
readonly
_onLoad
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onLoad
:
CommonEvent
<
void
>
=
this
.
_onLoad
.
event
;
private
hiddenTitleBarStyle
:
boolean
;
private
showTimeoutHandle
:
NodeJS
.
Timeout
;
private
_id
:
number
;
...
...
@@ -324,6 +327,21 @@ export class CodeWindow extends Disposable implements ICodeWindow {
return
this
.
_readyState
===
ReadyState
.
READY
;
}
get
whenClosedOrLoaded
():
Promise
<
void
>
{
return
new
Promise
<
void
>
(
resolve
=>
{
function
handle
()
{
closeListener
.
dispose
();
loadListener
.
dispose
();
resolve
();
}
const
closeListener
=
this
.
onClose
(()
=>
handle
());
const
loadListener
=
this
.
onLoad
(()
=>
handle
());
});
}
private
handleMarketplaceRequests
():
void
{
// Resolve marketplace headers
...
...
@@ -349,7 +367,11 @@ export class CodeWindow extends Disposable implements ICodeWindow {
this
.
_win
.
on
(
'
unresponsive
'
,
()
=>
this
.
onWindowError
(
WindowError
.
UNRESPONSIVE
));
// Window close
this
.
_win
.
on
(
'
closed
'
,
()
=>
this
.
_onClose
.
fire
());
this
.
_win
.
on
(
'
closed
'
,
()
=>
{
this
.
_onClose
.
fire
();
this
.
dispose
();
});
// Prevent loading of svgs
this
.
_win
.
webContents
.
session
.
webRequest
.
onBeforeRequest
(
null
!
,
(
details
,
callback
)
=>
{
...
...
@@ -606,6 +628,9 @@ export class CodeWindow extends Disposable implements ICodeWindow {
}
},
10000
);
}
// Event
this
.
_onLoad
.
fire
();
}
reload
(
configurationIn
?:
IWindowConfiguration
,
cli
?:
ParsedArgs
):
void
{
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
ffbc4885
...
...
@@ -166,9 +166,6 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
private
readonly
_onWindowClose
=
this
.
_register
(
new
Emitter
<
number
>
());
readonly
onWindowClose
:
CommonEvent
<
number
>
=
this
.
_onWindowClose
.
event
;
private
readonly
_onWindowLoad
=
this
.
_register
(
new
Emitter
<
number
>
());
readonly
onWindowLoad
:
CommonEvent
<
number
>
=
this
.
_onWindowLoad
.
event
;
private
readonly
_onWindowsCountChanged
=
this
.
_register
(
new
Emitter
<
IWindowsCountChangedEvent
>
());
readonly
onWindowsCountChanged
:
CommonEvent
<
IWindowsCountChangedEvent
>
=
this
.
_onWindowsCountChanged
.
event
;
...
...
@@ -502,7 +499,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
// process can continue. We do this by deleting the waitMarkerFilePath.
const
waitMarkerFileURI
=
openConfig
.
waitMarkerFileURI
;
if
(
openConfig
.
context
===
OpenContext
.
CLI
&&
waitMarkerFileURI
&&
usedWindows
.
length
===
1
&&
usedWindows
[
0
])
{
this
.
waitForWindowCloseOrLoad
(
usedWindows
[
0
].
id
)
.
then
(()
=>
fs
.
unlink
(
waitMarkerFileURI
.
fsPath
,
_error
=>
undefined
));
usedWindows
[
0
].
whenClosedOrLoaded
.
then
(()
=>
fs
.
unlink
(
waitMarkerFileURI
.
fsPath
,
_error
=>
undefined
));
}
return
usedWindows
;
...
...
@@ -1456,9 +1453,6 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
// Load it
window
.
load
(
configuration
);
// Signal event
this
.
_onWindowLoad
.
fire
(
window
.
id
);
}
private
getNewWindowState
(
configuration
:
IWindowConfiguration
):
INewWindowState
{
...
...
@@ -1642,22 +1636,6 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
return
this
.
open
({
context
,
cli
,
forceEmpty
:
true
,
forceNewWindow
,
forceReuseWindow
});
}
waitForWindowCloseOrLoad
(
windowId
:
number
):
Promise
<
void
>
{
return
new
Promise
<
void
>
(
resolve
=>
{
function
handler
(
id
:
number
)
{
if
(
id
===
windowId
)
{
closeListener
.
dispose
();
loadListener
.
dispose
();
resolve
();
}
}
const
closeListener
=
this
.
onWindowClose
(
id
=>
handler
(
id
));
const
loadListener
=
this
.
onWindowLoad
(
id
=>
handler
(
id
));
});
}
sendToFocused
(
channel
:
string
,
...
args
:
any
[]):
void
{
const
focusedWindow
=
this
.
getFocusedWindow
()
||
this
.
getLastActiveWindow
();
...
...
@@ -1700,9 +1678,6 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
private
onWindowClosed
(
win
:
ICodeWindow
):
void
{
// Tell window
win
.
dispose
();
// Remove from our list so that Electron can clean it up
const
index
=
WindowsManager
.
WINDOWS
.
indexOf
(
win
);
WindowsManager
.
WINDOWS
.
splice
(
index
,
1
);
...
...
src/vs/platform/launch/electron-main/launchMainService.ts
浏览文件 @
ffbc4885
...
...
@@ -188,7 +188,7 @@ export class LaunchMainService implements ILaunchMainService {
// In addition, we poll for the wait marker file to be deleted to return.
if
(
waitMarkerFileURI
&&
usedWindows
.
length
===
1
&&
usedWindows
[
0
])
{
return
Promise
.
race
([
this
.
windowsMainService
.
waitForWindowCloseOrLoad
(
usedWindows
[
0
].
id
)
,
usedWindows
[
0
].
whenClosedOrLoaded
,
whenDeleted
(
waitMarkerFileURI
.
fsPath
)
]).
then
(()
=>
undefined
,
()
=>
undefined
);
}
...
...
src/vs/platform/windows/electron-main/windows.ts
浏览文件 @
ffbc4885
...
...
@@ -35,6 +35,8 @@ export interface ICodeWindow extends IDisposable {
readonly
onClose
:
Event
<
void
>
;
readonly
onDestroy
:
Event
<
void
>
;
readonly
whenClosedOrLoaded
:
Promise
<
void
>
;
readonly
id
:
number
;
readonly
win
:
BrowserWindow
;
readonly
config
:
IWindowConfiguration
;
...
...
@@ -96,12 +98,15 @@ export interface IWindowsMainService {
readonly
onWindowReady
:
Event
<
ICodeWindow
>
;
readonly
onWindowsCountChanged
:
Event
<
IWindowsCountChangedEvent
>
;
readonly
onWindowClose
:
Event
<
number
>
;
open
(
openConfig
:
IOpenConfiguration
):
ICodeWindow
[];
openEmptyWindow
(
context
:
OpenContext
,
options
?:
IOpenEmptyWindowOptions
):
ICodeWindow
[];
openExtensionDevelopmentHostWindow
(
extensionDevelopmentPath
:
string
[],
openConfig
:
IOpenConfiguration
):
ICodeWindow
[];
closeWorkspace
(
win
:
ICodeWindow
):
void
;
reload
(
win
:
ICodeWindow
,
cli
?:
ParsedArgs
):
void
;
sendToFocused
(
channel
:
string
,
...
args
:
any
[]):
void
;
sendToAll
(
channel
:
string
,
payload
:
any
,
windowIdsToIgnore
?:
number
[]):
void
;
...
...
@@ -111,9 +116,6 @@ export interface IWindowsMainService {
getWindows
():
ICodeWindow
[];
getWindowCount
():
number
;
waitForWindowCloseOrLoad
(
windowId
:
number
):
Promise
<
void
>
;
reload
(
win
:
ICodeWindow
,
cli
?:
ParsedArgs
):
void
;
closeWorkspace
(
win
:
ICodeWindow
):
void
;
quit
():
void
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录