Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0a7c0fd6
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 搜索 >>
提交
0a7c0fd6
编写于
10月 12, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - lift more environment properties to electron-main
上级
ca4dd67a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
39 addition
and
33 deletion
+39
-33
src/vs/code/electron-browser/sharedProcess/contrib/nodeCachedDataCleaner.ts
...on-browser/sharedProcess/contrib/nodeCachedDataCleaner.ts
+4
-5
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
.../code/electron-browser/sharedProcess/sharedProcessMain.ts
+2
-1
src/vs/code/electron-main/sharedProcess.ts
src/vs/code/electron-main/sharedProcess.ts
+2
-1
src/vs/platform/environment/common/environment.ts
src/vs/platform/environment/common/environment.ts
+0
-9
src/vs/platform/environment/electron-main/environmentMainService.ts
...tform/environment/electron-main/environmentMainService.ts
+29
-1
src/vs/platform/environment/node/environmentService.ts
src/vs/platform/environment/node/environmentService.ts
+2
-12
src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts
src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts
+0
-4
未找到文件。
src/vs/code/electron-browser/sharedProcess/contrib/nodeCachedDataCleaner.ts
浏览文件 @
0a7c0fd6
...
...
@@ -7,7 +7,6 @@ import { basename, dirname, join } from 'vs/base/common/path';
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
toDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
readdir
,
rimraf
,
stat
}
from
'
vs/base/node/pfs
'
;
import
{
INativeEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
product
from
'
vs/platform/product/common/product
'
;
export
class
NodeCachedDataCleaner
{
...
...
@@ -19,7 +18,7 @@ export class NodeCachedDataCleaner {
private
readonly
_disposables
=
new
DisposableStore
();
constructor
(
@
INativeEnvironmentService
private
readonly
_environmentService
:
INativeEnvironmentService
private
readonly
nodeCachedDataDir
:
string
|
undefined
)
{
this
.
_manageCachedDataSoon
();
}
...
...
@@ -32,14 +31,14 @@ export class NodeCachedDataCleaner {
// Cached data is stored as user data and we run a cleanup task everytime
// the editor starts. The strategy is to delete all files that are older than
// 3 months (1 week respectively)
if
(
!
this
.
_environmentService
.
nodeCachedDataDir
)
{
if
(
!
this
.
nodeCachedDataDir
)
{
return
;
}
// The folder which contains folders of cached data. Each of these folder is per
// version
const
nodeCachedDataRootDir
=
dirname
(
this
.
_environmentService
.
nodeCachedDataDir
);
const
nodeCachedDataCurrent
=
basename
(
this
.
_environmentService
.
nodeCachedDataDir
);
const
nodeCachedDataRootDir
=
dirname
(
this
.
nodeCachedDataDir
);
const
nodeCachedDataCurrent
=
basename
(
this
.
nodeCachedDataDir
);
let
handle
:
NodeJS
.
Timeout
|
undefined
=
setTimeout
(()
=>
{
handle
=
undefined
;
...
...
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
浏览文件 @
0a7c0fd6
...
...
@@ -84,6 +84,7 @@ interface ISharedProcessInitData {
sharedIPCHandle
:
string
;
args
:
NativeParsedArgs
;
logLevel
:
LogLevel
;
nodeCachedDataDir
?:
string
;
backupWorkspacesPath
:
string
;
}
...
...
@@ -261,7 +262,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
(
localizationsService
as
LocalizationsService
).
update
();
// cache clean ups
disposables
.
add
(
combinedDisposable
(
instantiationService2
.
createInstance
(
NodeCachedDataCleane
r
),
new
NodeCachedDataCleaner
(
initData
.
nodeCachedDataDi
r
),
instantiationService2
.
createInstance
(
LanguagePackCachedDataCleaner
),
instantiationService2
.
createInstance
(
StorageDataCleaner
,
initData
.
backupWorkspacesPath
),
instantiationService2
.
createInstance
(
LogsDataCleaner
),
...
...
src/vs/code/electron-main/sharedProcess.ts
浏览文件 @
0a7c0fd6
...
...
@@ -116,7 +116,8 @@ export class SharedProcess implements ISharedProcess {
sharedIPCHandle
:
this
.
environmentService
.
sharedIPCHandle
,
args
:
this
.
environmentService
.
args
,
logLevel
:
this
.
logService
.
getLevel
(),
backupWorkspacesPath
:
this
.
environmentService
.
backupWorkspacesPath
backupWorkspacesPath
:
this
.
environmentService
.
backupWorkspacesPath
,
nodeCachedDataDir
:
this
.
environmentService
.
nodeCachedDataDir
});
// signal exit to shared process when we get disposed
...
...
src/vs/platform/environment/common/environment.ts
浏览文件 @
0a7c0fd6
...
...
@@ -44,7 +44,6 @@ export interface IEnvironmentService {
// --- data paths
untitledWorkspacesHome
:
URI
;
globalStorageHome
:
URI
;
workspaceStorageHome
:
URI
;
...
...
@@ -69,7 +68,6 @@ export interface IEnvironmentService {
// --- telemetry
disableTelemetry
:
boolean
;
telemetryLogResource
:
URI
;
serviceMachineIdResource
:
URI
;
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
...
...
@@ -100,11 +98,9 @@ export interface INativeEnvironmentService extends IEnvironmentService {
tmpDir
:
URI
;
userDataPath
:
string
;
machineSettingsResource
:
URI
;
nodeCachedDataDir
?:
string
;
installSourcePath
:
string
;
// --- IPC Handles
mainIPCHandle
:
string
;
sharedIPCHandle
:
string
;
// --- Extensions
...
...
@@ -114,11 +110,6 @@ export interface INativeEnvironmentService extends IEnvironmentService {
// --- Smoke test support
driverHandle
?:
string
;
driverVerbose
:
boolean
;
// --- Misc. config
disableUpdates
:
boolean
;
sandbox
:
boolean
;
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE. AS SUCH:
...
...
src/vs/platform/environment/electron-main/environmentMainService.ts
浏览文件 @
0a7c0fd6
...
...
@@ -7,7 +7,7 @@ import { join } from 'vs/base/common/path';
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
INativeEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
NativeEnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
{
getIPCHandle
,
NativeEnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
export
const
IEnvironmentMainService
=
createDecorator
<
IEnvironmentMainService
>
(
'
environmentMainService
'
);
...
...
@@ -16,8 +16,21 @@ export const IEnvironmentMainService = createDecorator<IEnvironmentMainService>(
* environments.
*/
export
interface
IEnvironmentMainService
extends
INativeEnvironmentService
{
// --- backup paths
backupHome
:
string
;
backupWorkspacesPath
:
string
;
// --- V8 script cache path
nodeCachedDataDir
?:
string
;
// --- IPC
mainIPCHandle
:
string
;
// --- config
sandbox
:
boolean
;
driverVerbose
:
boolean
;
disableUpdates
:
boolean
;
}
export
class
EnvironmentMainService
extends
NativeEnvironmentService
{
...
...
@@ -27,4 +40,19 @@ export class EnvironmentMainService extends NativeEnvironmentService {
@
memoize
get
backupWorkspacesPath
():
string
{
return
join
(
this
.
backupHome
,
'
workspaces.json
'
);
}
@
memoize
get
mainIPCHandle
():
string
{
return
getIPCHandle
(
this
.
userDataPath
,
'
main
'
);
}
@
memoize
get
sandbox
():
boolean
{
return
!!
this
.
_args
[
'
__sandbox
'
];
}
@
memoize
get
driverVerbose
():
boolean
{
return
!!
this
.
_args
[
'
driver-verbose
'
];
}
@
memoize
get
disableUpdates
():
boolean
{
return
!!
this
.
_args
[
'
disable-updates
'
];
}
@
memoize
get
nodeCachedDataDir
():
string
|
undefined
{
return
process
.
env
[
'
VSCODE_NODE_CACHED_DATA_DIR
'
]
||
undefined
;
}
}
src/vs/platform/environment/node/environmentService.ts
浏览文件 @
0a7c0fd6
...
...
@@ -189,32 +189,22 @@ export class NativeEnvironmentService implements INativeEnvironmentService {
get
verbose
():
boolean
{
return
!!
this
.
_args
.
verbose
;
}
get
logLevel
():
string
|
undefined
{
return
this
.
_args
.
log
;
}
@
memoize
get
mainIPCHandle
():
string
{
return
getIPCHandle
(
this
.
userDataPath
,
'
main
'
);
}
@
memoize
get
sharedIPCHandle
():
string
{
return
getIPCHandle
(
this
.
userDataPath
,
'
shared
'
);
}
@
memoize
get
nodeCachedDataDir
():
string
|
undefined
{
return
process
.
env
[
'
VSCODE_NODE_CACHED_DATA_DIR
'
]
||
undefined
;
}
@
memoize
get
serviceMachineIdResource
():
URI
{
return
resources
.
joinPath
(
URI
.
file
(
this
.
userDataPath
),
'
machineid
'
);
}
get
disableUpdates
():
boolean
{
return
!!
this
.
_args
[
'
disable-updates
'
];
}
get
crashReporterId
():
string
|
undefined
{
return
this
.
_args
[
'
crash-reporter-id
'
];
}
get
crashReporterDirectory
():
string
|
undefined
{
return
this
.
_args
[
'
crash-reporter-directory
'
];
}
get
driverHandle
():
string
|
undefined
{
return
this
.
_args
[
'
driver
'
];
}
get
driverVerbose
():
boolean
{
return
!!
this
.
_args
[
'
driver-verbose
'
];
}
@
memoize
get
telemetryLogResource
():
URI
{
return
URI
.
file
(
path
.
join
(
this
.
logsPath
,
'
telemetry.log
'
));
}
get
disableTelemetry
():
boolean
{
return
!!
this
.
_args
[
'
disable-telemetry
'
];
}
get
sandbox
():
boolean
{
return
!!
this
.
_args
[
'
__sandbox
'
];
}
constructor
(
private
_args
:
NativeParsedArgs
)
{
constructor
(
protected
_args
:
NativeParsedArgs
)
{
if
(
!
process
.
env
[
'
VSCODE_LOGS
'
])
{
const
key
=
toLocalISOString
(
new
Date
()).
replace
(
/-|:|
\.\d
+Z$/g
,
''
);
process
.
env
[
'
VSCODE_LOGS
'
]
=
path
.
join
(
this
.
userDataPath
,
'
logs
'
,
key
);
...
...
@@ -261,7 +251,7 @@ function getWin32IPCHandle(userDataPath: string, type: string): string {
return
`\\\\.\\pipe\
\$
{scope}-
${
product
.
version
}
-
${
type
}
-sock`
;
}
function
getIPCHandle
(
userDataPath
:
string
,
type
:
string
):
string
{
export
function
getIPCHandle
(
userDataPath
:
string
,
type
:
string
):
string
{
if
(
isWindows
)
{
return
getWin32IPCHandle
(
userDataPath
,
type
);
}
...
...
src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts
浏览文件 @
0a7c0fd6
...
...
@@ -126,7 +126,6 @@ export class SimpleNativeWorkbenchEnvironmentService implements INativeWorkbench
installSourcePath
:
string
=
undefined
!
;
mainIPCHandle
:
string
=
undefined
!
;
sharedIPCHandle
:
string
=
undefined
!
;
extensionsPath
?:
string
|
undefined
;
...
...
@@ -134,15 +133,12 @@ export class SimpleNativeWorkbenchEnvironmentService implements INativeWorkbench
builtinExtensionsPath
:
string
=
undefined
!
;
driverHandle
?:
string
|
undefined
;
driverVerbose
=
false
;
crashReporterDirectory
?:
string
|
undefined
;
crashReporterId
?:
string
|
undefined
;
nodeCachedDataDir
?:
string
|
undefined
;
disableUpdates
=
false
;
sandbox
=
true
;
verbose
=
false
;
isBuilt
=
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录