Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f22dcae3
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 搜索 >>
提交
f22dcae3
编写于
6月 15, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipc - have an explicit method to mark a window ready
上级
bc9c87a8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
29 addition
and
29 deletion
+29
-29
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+9
-3
src/vs/platform/electron/common/electron.ts
src/vs/platform/electron/common/electron.ts
+1
-0
src/vs/platform/electron/electron-main/electronMainService.ts
...vs/platform/electron/electron-main/electronMainService.ts
+7
-0
src/vs/platform/windows/electron-main/windows.ts
src/vs/platform/windows/electron-main/windows.ts
+0
-3
src/vs/platform/windows/electron-main/windowsMainService.ts
src/vs/platform/windows/electron-main/windowsMainService.ts
+9
-21
src/vs/workbench/electron-browser/window.ts
src/vs/workbench/electron-browser/window.ts
+2
-2
src/vs/workbench/test/electron-browser/workbenchTestServices.ts
.../workbench/test/electron-browser/workbenchTestServices.ts
+1
-0
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
f22dcae3
...
...
@@ -91,15 +91,18 @@ export class CodeWindow extends Disposable implements ICodeWindow {
private
static
readonly
MAX_URL_LENGTH
=
2
*
1024
*
1024
;
// https://cs.chromium.org/chromium/src/url/url_constants.cc?l=32
private
readonly
_onLoad
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onLoad
=
this
.
_onLoad
.
event
;
private
readonly
_onReady
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onReady
=
this
.
_onReady
.
event
;
private
readonly
_onClose
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onClose
=
this
.
_onClose
.
event
;
private
readonly
_onDestroy
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onDestroy
=
this
.
_onDestroy
.
event
;
private
readonly
_onLoad
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onLoad
=
this
.
_onLoad
.
event
;
private
hiddenTitleBarStyle
:
boolean
|
undefined
;
private
showTimeoutHandle
:
NodeJS
.
Timeout
|
undefined
;
private
_lastFocusTime
:
number
;
...
...
@@ -346,6 +349,9 @@ export class CodeWindow extends Disposable implements ICodeWindow {
while
(
this
.
whenReadyCallbacks
.
length
)
{
this
.
whenReadyCallbacks
.
pop
()
!
(
this
);
}
// Events
this
.
_onReady
.
fire
();
}
ready
():
Promise
<
ICodeWindow
>
{
...
...
src/vs/platform/electron/common/electron.ts
浏览文件 @
f22dcae3
...
...
@@ -82,6 +82,7 @@ export interface ICommonElectronService {
toggleWindowTabsBar
():
Promise
<
void
>
;
// Lifecycle
notifyReady
():
Promise
<
void
>
relaunch
(
options
?:
{
addArgs
?:
string
[],
removeArgs
?:
string
[]
}):
Promise
<
void
>
;
reload
(
options
?:
{
disableExtensions
?:
boolean
}):
Promise
<
void
>
;
closeWindow
():
Promise
<
void
>
;
...
...
src/vs/platform/electron/electron-main/electronMainService.ts
浏览文件 @
f22dcae3
...
...
@@ -370,6 +370,13 @@ export class ElectronMainService implements IElectronMainService {
//#region Lifecycle
async
notifyReady
(
windowId
:
number
|
undefined
):
Promise
<
void
>
{
const
window
=
this
.
windowById
(
windowId
);
if
(
window
)
{
window
.
setReady
();
}
}
async
relaunch
(
windowId
:
number
|
undefined
,
options
?:
{
addArgs
?:
string
[],
removeArgs
?:
string
[]
}):
Promise
<
void
>
{
return
this
.
lifecycleMainService
.
relaunch
(
options
);
}
...
...
src/vs/platform/windows/electron-main/windows.ts
浏览文件 @
f22dcae3
...
...
@@ -33,9 +33,6 @@ export const enum WindowMode {
export
interface
ICodeWindow
extends
IDisposable
{
readonly
onClose
:
Event
<
void
>
;
readonly
onDestroy
:
Event
<
void
>
;
readonly
whenClosedOrLoaded
:
Promise
<
void
>
;
readonly
id
:
number
;
...
...
src/vs/platform/windows/electron-main/windowsMainService.ts
浏览文件 @
f22dcae3
...
...
@@ -15,7 +15,7 @@ import { ParsedArgs } from 'vs/platform/environment/node/argv';
import
{
INativeEnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
{
IStateService
}
from
'
vs/platform/state/node/state
'
;
import
{
CodeWindow
,
defaultWindowState
}
from
'
vs/code/electron-main/window
'
;
import
{
ipcMain
as
ipc
,
screen
,
BrowserWindow
,
MessageBoxOptions
,
Display
,
app
,
nativeTheme
}
from
'
electron
'
;
import
{
screen
,
BrowserWindow
,
MessageBoxOptions
,
Display
,
app
,
nativeTheme
}
from
'
electron
'
;
import
{
ILifecycleMainService
,
UnloadReason
,
LifecycleMainService
,
LifecycleMainPhase
}
from
'
vs/platform/lifecycle/electron-main/lifecycleMainService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
...
...
@@ -212,19 +212,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
private
registerListeners
():
void
{
// React to workbench ready events from windows
ipc
.
on
(
'
vscode:workbenchReady
'
,
(
event
:
Event
,
windowId
:
number
)
=>
{
this
.
logService
.
trace
(
'
IPC#vscode-workbenchReady
'
);
const
win
=
this
.
getWindowById
(
windowId
);
if
(
win
)
{
win
.
setReady
();
// Event
this
.
_onWindowReady
.
fire
(
win
);
}
});
// React to HC color scheme changes (Windows)
if
(
isWindows
)
{
nativeTheme
.
on
(
'
updated
'
,
()
=>
{
...
...
@@ -1434,24 +1421,25 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
if
(
options
.
forceNewTabbedWindow
)
{
const
activeWindow
=
this
.
getLastActiveWindow
();
if
(
activeWindow
)
{
activeWindow
.
addTabbedWindow
(
w
indow
);
activeWindow
.
addTabbedWindow
(
createdW
indow
);
}
}
// Add to our list of windows
WindowsMainService
.
WINDOWS
.
push
(
w
indow
);
WindowsMainService
.
WINDOWS
.
push
(
createdW
indow
);
// Indicate number change via event
this
.
_onWindowsCountChanged
.
fire
({
oldCount
:
WindowsMainService
.
WINDOWS
.
length
-
1
,
newCount
:
WindowsMainService
.
WINDOWS
.
length
});
// Window Events
once
(
window
.
onClose
)(()
=>
this
.
onWindowClosed
(
createdWindow
));
once
(
window
.
onDestroy
)(()
=>
this
.
onBeforeWindowClose
(
createdWindow
));
// try to save state before destroy because close will not fire
window
.
win
.
webContents
.
removeAllListeners
(
'
devtools-reload-page
'
);
// remove built in listener so we can handle this on our own
window
.
win
.
webContents
.
on
(
'
devtools-reload-page
'
,
()
=>
this
.
lifecycleMainService
.
reload
(
createdWindow
));
once
(
createdWindow
.
onReady
)(()
=>
this
.
_onWindowReady
.
fire
(
createdWindow
));
once
(
createdWindow
.
onClose
)(()
=>
this
.
onWindowClosed
(
createdWindow
));
once
(
createdWindow
.
onDestroy
)(()
=>
this
.
onBeforeWindowClose
(
createdWindow
));
// try to save state before destroy because close will not fire
createdWindow
.
win
.
webContents
.
removeAllListeners
(
'
devtools-reload-page
'
);
// remove built in listener so we can handle this on our own
createdWindow
.
win
.
webContents
.
on
(
'
devtools-reload-page
'
,
()
=>
this
.
lifecycleMainService
.
reload
(
createdWindow
));
// Lifecycle
(
this
.
lifecycleMainService
as
LifecycleMainService
).
registerWindow
(
w
indow
);
(
this
.
lifecycleMainService
as
LifecycleMainService
).
registerWindow
(
createdW
indow
);
}
// Existing window
...
...
src/vs/workbench/electron-browser/window.ts
浏览文件 @
f22dcae3
...
...
@@ -397,8 +397,8 @@ export class NativeWindow extends Disposable {
// Handle open calls
this
.
setupOpenHandlers
();
//
Emit event when vscode is
ready
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Ready
).
then
(()
=>
ipcRenderer
.
send
(
'
vscode:workbenchReady
'
,
this
.
electronService
.
windowId
));
//
Notify main side when window
ready
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Ready
).
then
(()
=>
this
.
electronService
.
notifyReady
(
));
// Integrity warning
this
.
integrityService
.
isPure
().
then
(
res
=>
this
.
titleService
.
updateProperties
({
isPure
:
res
.
isPure
}));
...
...
src/vs/workbench/test/electron-browser/workbenchTestServices.ts
浏览文件 @
f22dcae3
...
...
@@ -213,6 +213,7 @@ export class TestElectronService implements IElectronService {
async
moveWindowTabToNewWindow
():
Promise
<
void
>
{
}
async
mergeAllWindowTabs
():
Promise
<
void
>
{
}
async
toggleWindowTabsBar
():
Promise
<
void
>
{
}
async
notifyReady
():
Promise
<
void
>
{
}
async
relaunch
(
options
?:
{
addArgs
?:
string
[]
|
undefined
;
removeArgs
?:
string
[]
|
undefined
;
}
|
undefined
):
Promise
<
void
>
{
}
async
reload
():
Promise
<
void
>
{
}
async
closeWindow
():
Promise
<
void
>
{
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录