Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9eceaa4c
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 搜索 >>
提交
9eceaa4c
编写于
10月 30, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
storage - less waterfall startup
上级
4b2fac2b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
180 addition
and
175 deletion
+180
-175
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+180
-175
未找到文件。
src/vs/workbench/electron-browser/main.ts
浏览文件 @
9eceaa4c
...
...
@@ -112,15 +112,13 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> {
// Resolve a workspace payload that we can get the workspace ID from
return
createWorkspaceInitializationPayload
(
configuration
,
environmentService
).
then
(
payload
=>
{
// Prepare the workspace storage folder
return
prepareWorkspaceStorageFolder
(
payload
,
environmentService
).
then
(
workspaceStoragePath
=>
{
return
Promise
.
all
([
// Create and initialize workspace/configuration service
createWorkspaceService
(
payload
,
environmentService
,
logService
),
// Create and initialize storage service
createStorageService
(
workspaceStoragePath
,
payload
,
environmentService
,
logService
)
createStorageService
(
payload
,
environmentService
,
logService
)
]).
then
(
services
=>
{
const
workspaceService
=
services
[
0
];
const
storageService
=
new
DelegatingStorageService
(
services
[
1
],
createStorageLegacyService
(
workspaceService
,
environmentService
),
logService
,
workspaceService
);
...
...
@@ -139,7 +137,7 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> {
// Store meta file in workspace storage after workbench is running
shell
.
onRunning
(()
=>
{
ensureWorkspaceStorageFolderMeta
(
workspaceStoragePath
,
workspace
Service
);
ensureWorkspaceStorageFolderMeta
(
payload
,
workspaceService
,
environment
Service
);
});
// Gracefully Shutdown Storage
...
...
@@ -161,7 +159,6 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> {
});
});
});
});
}
function
createWorkspaceInitializationPayload
(
configuration
:
IWindowConfiguration
,
environmentService
:
EnvironmentService
):
Promise
<
IWorkspaceInitializationPayload
>
{
...
...
@@ -234,8 +231,12 @@ function resolveSingleFolderWorkspaceInitializationPayload(folderUri: ISingleFol
},
error
=>
onUnexpectedError
(
error
));
}
function
getWorkspaceStoragePath
(
payload
:
IWorkspaceInitializationPayload
,
environmentService
:
IEnvironmentService
):
string
{
return
join
(
environmentService
.
workspaceStorageHome
,
payload
.
id
);
// workspace home + workspace id;
}
function
prepareWorkspaceStorageFolder
(
payload
:
IWorkspaceInitializationPayload
,
environmentService
:
IEnvironmentService
):
Thenable
<
string
>
{
const
workspaceStoragePath
=
join
(
environmentService
.
workspaceStorageHome
,
payload
.
id
);
// workspace home + workspace id
const
workspaceStoragePath
=
getWorkspaceStoragePath
(
payload
,
environmentService
);
return
exists
(
workspaceStoragePath
).
then
(
exists
=>
{
if
(
exists
)
{
...
...
@@ -246,13 +247,13 @@ function prepareWorkspaceStorageFolder(payload: IWorkspaceInitializationPayload,
});
}
function
ensureWorkspaceStorageFolderMeta
(
workspaceStoragePath
:
string
,
workspaceService
:
IWorkspaceContex
tService
):
void
{
function
ensureWorkspaceStorageFolderMeta
(
payload
:
IWorkspaceInitializationPayload
,
workspaceService
:
IWorkspaceContextService
,
environmentService
:
IEnvironmen
tService
):
void
{
const
state
=
workspaceService
.
getWorkbenchState
();
if
(
state
===
WorkbenchState
.
EMPTY
)
{
return
;
// no storage meta for empty workspaces
}
const
workspaceStorageMetaPath
=
join
(
workspaceStoragePath
,
'
workspace.json
'
);
const
workspaceStorageMetaPath
=
join
(
getWorkspaceStoragePath
(
payload
,
environmentService
)
,
'
workspace.json
'
);
exists
(
workspaceStorageMetaPath
).
then
(
exists
=>
{
if
(
exists
)
{
...
...
@@ -279,7 +280,10 @@ function createWorkspaceService(payload: IWorkspaceInitializationPayload, enviro
});
}
function
createStorageService
(
workspaceStorageFolder
:
string
,
payload
:
IWorkspaceInitializationPayload
,
environmentService
:
IEnvironmentService
,
logService
:
ILogService
):
Thenable
<
StorageService
>
{
function
createStorageService
(
payload
:
IWorkspaceInitializationPayload
,
environmentService
:
IEnvironmentService
,
logService
:
ILogService
):
Thenable
<
StorageService
>
{
// Prepare the workspace storage folder
return
prepareWorkspaceStorageFolder
(
payload
,
environmentService
).
then
(
workspaceStorageFolder
=>
{
// Return early if we are using in-memory storage
const
useInMemoryStorage
=
!!
environmentService
.
extensionTestsPath
;
/* never keep any state when running extension tests */
...
...
@@ -427,6 +431,7 @@ function createStorageService(workspaceStorageFolder: string, payload: IWorkspac
});
});
});
});
}
function
createStorageLegacyService
(
workspaceService
:
IWorkspaceContextService
,
environmentService
:
IEnvironmentService
):
IStorageLegacyService
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录