Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
252d49c6
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,发现更多精彩内容 >>
提交
252d49c6
编写于
12月 13, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify AbstractThreadService usage (#36972)
上级
29e57ecf
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
26 addition
and
73 deletion
+26
-73
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+2
-3
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+5
-0
src/vs/workbench/api/node/extHostExtensionService.ts
src/vs/workbench/api/node/extHostExtensionService.ts
+3
-4
src/vs/workbench/api/node/extHostWindow.ts
src/vs/workbench/api/node/extHostWindow.ts
+4
-5
src/vs/workbench/node/extensionHostMain.ts
src/vs/workbench/node/extensionHostMain.ts
+2
-3
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
.../services/extensions/electron-browser/extensionService.ts
+3
-3
src/vs/workbench/services/thread/common/threadService.ts
src/vs/workbench/services/thread/common/threadService.ts
+0
-17
src/vs/workbench/services/thread/electron-browser/threadService.ts
...rkbench/services/thread/electron-browser/threadService.ts
+0
-17
src/vs/workbench/services/thread/node/abstractThreadService.ts
...s/workbench/services/thread/node/abstractThreadService.ts
+4
-3
src/vs/workbench/services/thread/node/extHostThreadService.ts
...vs/workbench/services/thread/node/extHostThreadService.ts
+0
-15
src/vs/workbench/test/electron-browser/api/testThreadService.ts
.../workbench/test/electron-browser/api/testThreadService.ts
+3
-3
未找到文件。
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
252d49c6
...
...
@@ -46,10 +46,9 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
*
as
vscode
from
'
vscode
'
;
import
*
as
paths
from
'
vs/base/common/paths
'
;
import
{
MainContext
,
ExtHostContext
,
IInitData
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
ExtHostContext
,
IInitData
,
IExtHostContext
}
from
'
./extHost.protocol
'
;
import
*
as
languageConfiguration
from
'
vs/editor/common/modes/languageConfiguration
'
;
import
{
TextEditorCursorStyle
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
ExtHostThreadService
}
from
'
vs/workbench/services/thread/node/extHostThreadService
'
;
import
{
ProxyIdentifier
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
ExtHostDialogs
}
from
'
vs/workbench/api/node/extHostDialogs
'
;
import
{
ExtHostFileSystem
}
from
'
vs/workbench/api/node/extHostFileSystem
'
;
...
...
@@ -79,7 +78,7 @@ function proposedApiFunction<T>(extension: IExtensionDescription, fn: T): T {
*/
export
function
createApiFactory
(
initData
:
IInitData
,
threadService
:
ExtHostThreadService
,
threadService
:
IExtHostContext
,
extHostWorkspace
:
ExtHostWorkspace
,
extHostConfiguration
:
ExtHostConfiguration
,
extensionService
:
ExtHostExtensionService
,
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
252d49c6
...
...
@@ -100,6 +100,11 @@ export interface IExtHostContext {
* Register manually created instance.
*/
set
<
T
,
R
extends
T
>
(
identifier
:
ProxyIdentifier
<
T
>
,
instance
:
R
):
R
;
/**
* Assert these identifiers are already registered via `.set`.
*/
assertRegistered
(
identifiers
:
ProxyIdentifier
<
any
>
[]):
void
;
}
export
interface
IMainContext
{
...
...
src/vs/workbench/api/node/extHostExtensionService.ts
浏览文件 @
252d49c6
...
...
@@ -13,9 +13,8 @@ import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/n
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
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
{
MainContext
,
MainThreadExtensionServiceShape
,
IWorkspaceData
,
IEnvironment
,
IInitData
,
ExtHostExtensionServiceShape
,
MainThreadTelemetryShape
,
IExtHostContext
}
from
'
./extHost.protocol
'
;
import
{
IExtensionMemento
,
ExtensionsActivator
,
ActivatedExtension
,
IExtensionAPI
,
IExtensionContext
,
EmptyExtension
,
IExtensionModule
,
ExtensionActivationTimesBuilder
,
ExtensionActivationTimes
,
ExtensionActivationReason
,
ExtensionActivatedByEvent
}
from
'
vs/workbench/api/node/extHostExtensionActivator
'
;
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
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
...
...
@@ -112,7 +111,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
private
readonly
_barrier
:
Barrier
;
private
readonly
_registry
:
ExtensionDescriptionRegistry
;
private
readonly
_threadService
:
ExtHostThreadService
;
private
readonly
_threadService
:
IExtHostContext
;
private
readonly
_mainThreadTelemetry
:
MainThreadTelemetryShape
;
private
readonly
_storage
:
ExtHostStorage
;
private
readonly
_storagePath
:
ExtensionStoragePath
;
...
...
@@ -124,7 +123,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
* This class is constructed manually because it is a service, so it doesn't use any ctor injection
*/
constructor
(
initData
:
IInitData
,
threadService
:
ExtHostThreadService
,
threadService
:
IExtHostContext
,
extHostWorkspace
:
ExtHostWorkspace
,
extHostConfiguration
:
ExtHostConfiguration
,
logService
:
ILogService
...
...
src/vs/workbench/api/node/extHostWindow.ts
浏览文件 @
252d49c6
...
...
@@ -5,8 +5,7 @@
'
use strict
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
ExtHostWindowShape
,
MainContext
,
MainThreadWindowShape
}
from
'
./extHost.protocol
'
;
import
{
ExtHostWindowShape
,
MainContext
,
MainThreadWindowShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
{
WindowState
}
from
'
vscode
'
;
export
class
ExtHostWindow
implements
ExtHostWindowShape
{
...
...
@@ -23,8 +22,8 @@ export class ExtHostWindow implements ExtHostWindowShape {
private
_state
=
ExtHostWindow
.
InitialState
;
get
state
():
WindowState
{
return
this
.
_state
;
}
constructor
(
threadService
:
IThreadService
)
{
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadWindow
);
constructor
(
mainContext
:
IMainContext
)
{
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadWindow
);
this
.
_proxy
.
$getWindowVisibility
().
then
(
isFocused
=>
this
.
$onDidChangeWindowFocus
(
isFocused
));
}
...
...
@@ -36,4 +35,4 @@ export class ExtHostWindow implements ExtHostWindowShape {
this
.
_state
=
{
...
this
.
_state
,
focused
};
this
.
_onDidChangeWindowState
.
fire
(
this
.
_state
);
}
}
\ No newline at end of file
}
src/vs/workbench/node/extensionHostMain.ts
浏览文件 @
252d49c6
...
...
@@ -9,9 +9,7 @@ import nls = require('vs/nls');
import
pfs
=
require
(
'
vs/base/node/pfs
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
join
}
from
'
path
'
;
import
{
RPCProtocol
}
from
'
vs/workbench/services/extensions/node/rpcProtocol
'
;
import
{
ExtHostExtensionService
}
from
'
vs/workbench/api/node/extHostExtensionService
'
;
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
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
...
...
@@ -27,6 +25,7 @@ import { createLogService } from 'vs/platform/log/node/spdlogService';
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IMessagePassingProtocol
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
AbstractThreadService
}
from
'
vs/workbench/services/thread/node/abstractThreadService
'
;
// const nativeExit = process.exit.bind(process);
function
patchProcess
(
allowExit
:
boolean
)
{
...
...
@@ -89,7 +88,7 @@ export class ExtensionHostMain {
patchProcess
(
allowExit
);
// services
const
threadService
=
new
ExtHostThreadService
(
new
RPCProtocol
(
protocol
)
);
const
threadService
=
new
AbstractThreadService
(
protocol
,
false
);
const
extHostWorkspace
=
new
ExtHostWorkspace
(
threadService
,
initData
.
workspace
);
const
environmentService
=
new
EnvironmentService
(
initData
.
args
,
initData
.
execPath
);
this
.
_logService
=
createLogService
(
`exthost
${
initData
.
windowId
}
`
,
environmentService
);
...
...
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
浏览文件 @
252d49c6
...
...
@@ -28,7 +28,6 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
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
{
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
'
;
...
...
@@ -42,6 +41,7 @@ import { ExtensionHostProfiler } from 'vs/workbench/services/extensions/electron
import
{
ReloadWindowAction
}
from
'
vs/workbench/electron-browser/actions
'
;
import
product
from
'
vs/platform/node/product
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
AbstractThreadService
}
from
'
vs/workbench/services/thread/node/abstractThreadService
'
;
const
SystemExtensionsRoot
=
path
.
normalize
(
path
.
join
(
URI
.
parse
(
require
.
toUrl
(
''
)).
fsPath
,
'
..
'
,
'
extensions
'
));
...
...
@@ -85,7 +85,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
private
_extensionHostProcessActivationTimes
:
{
[
id
:
string
]:
ActivationTimes
;
};
private
_extensionHostExtensionRuntimeErrors
:
{
[
id
:
string
]:
Error
[];
};
private
_extensionHostProcessWorker
:
ExtensionHostProcessWorker
;
private
_extensionHostProcessThreadService
:
Main
ThreadService
;
private
_extensionHostProcessThreadService
:
Abstract
ThreadService
;
private
_extensionHostProcessCustomers
:
IDisposable
[];
/**
* winjs believes a proxy is a promise because it has a `then` method, so wrap the result in an object.
...
...
@@ -238,7 +238,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
protocol
=
asLoggingProtocol
(
protocol
);
}
this
.
_extensionHostProcessThreadService
=
new
MainThreadService
(
protocol
);
this
.
_extensionHostProcessThreadService
=
new
AbstractThreadService
(
protocol
,
true
);
const
extHostContext
:
IExtHostContext
=
this
.
_extensionHostProcessThreadService
;
// Named customers
...
...
src/vs/workbench/services/thread/common/threadService.ts
浏览文件 @
252d49c6
...
...
@@ -4,23 +4,6 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
export
interface
IThreadService
{
/**
* Always returns a proxy.
*/
get
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
;
/**
* Register instance.
*/
set
<
T
,
R
extends
T
>
(
identifier
:
ProxyIdentifier
<
T
>
,
value
:
R
):
R
;
/**
* Assert these identifiers are already registered via `.set`.
*/
assertRegistered
(
identifiers
:
ProxyIdentifier
<
any
>
[]):
void
;
}
export
class
ProxyIdentifier
<
T
>
{
_proxyIdentifierBrand
:
void
;
_suppressCompilerUnusedWarning
:
T
;
...
...
src/vs/workbench/services/thread/electron-browser/threadService.ts
已删除
100644 → 0
浏览文件 @
29e57ecf
/*---------------------------------------------------------------------------------------------
* 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
{
RPCProtocol
}
from
'
vs/workbench/services/extensions/node/rpcProtocol
'
;
import
{
AbstractThreadService
}
from
'
vs/workbench/services/thread/node/abstractThreadService
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
IMessagePassingProtocol
}
from
'
vs/base/parts/ipc/common/ipc
'
;
export
class
MainThreadService
extends
AbstractThreadService
implements
IThreadService
{
constructor
(
protocol
:
IMessagePassingProtocol
)
{
super
(
new
RPCProtocol
(
protocol
),
true
);
}
}
src/vs/workbench/services/thread/node/abstractThreadService.ts
浏览文件 @
252d49c6
...
...
@@ -8,18 +8,19 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
IDispatcher
,
RPCProtocol
}
from
'
vs/workbench/services/extensions/node/rpcProtocol
'
;
import
{
ProxyIdentifier
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
{
IMessagePassingProtocol
}
from
'
vs/base/parts/ipc/common/ipc
'
;
declare
var
Proxy
:
any
;
// TODO@TypeScript
export
abstract
class
AbstractThreadService
implements
IDispatcher
{
export
class
AbstractThreadService
implements
IDispatcher
{
private
readonly
_rpcProtocol
:
RPCProtocol
;
private
readonly
_isMain
:
boolean
;
protected
readonly
_locals
:
{
[
id
:
string
]:
any
;
};
private
readonly
_proxies
:
{
[
id
:
string
]:
any
;
}
=
Object
.
create
(
null
);
constructor
(
rpcProtocol
:
RPC
Protocol
,
isMain
:
boolean
)
{
this
.
_rpcProtocol
=
rpcProtocol
;
constructor
(
protocol
:
IMessagePassing
Protocol
,
isMain
:
boolean
)
{
this
.
_rpcProtocol
=
new
RPCProtocol
(
protocol
)
;
this
.
_isMain
=
isMain
;
this
.
_locals
=
Object
.
create
(
null
);
this
.
_proxies
=
Object
.
create
(
null
);
...
...
src/vs/workbench/services/thread/node/extHostThreadService.ts
已删除
100644 → 0
浏览文件 @
29e57ecf
/*---------------------------------------------------------------------------------------------
* 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
{
RPCProtocol
}
from
'
vs/workbench/services/extensions/node/rpcProtocol
'
;
import
{
AbstractThreadService
}
from
'
vs/workbench/services/thread/node/abstractThreadService
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
export
class
ExtHostThreadService
extends
AbstractThreadService
implements
IThreadService
{
constructor
(
rpcProtocol
:
RPCProtocol
)
{
super
(
rpcProtocol
,
false
);
}
}
src/vs/workbench/test/electron-browser/api/testThreadService.ts
浏览文件 @
252d49c6
...
...
@@ -6,9 +6,9 @@
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IThreadService
,
ProxyIdentifier
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
ProxyIdentifier
}
from
'
vs/workbench/services/thread/common/threadService
'
;
export
function
OneGetThreadService
(
thing
:
any
)
:
IThreadService
{
export
function
OneGetThreadService
(
thing
:
any
)
{
return
{
get
<
T
>
():
T
{
return
thing
;
...
...
@@ -75,7 +75,7 @@ export abstract class AbstractTestThreadService {
protected
abstract
_callOnRemote
(
proxyId
:
string
,
path
:
string
,
args
:
any
[]):
TPromise
<
any
>
;
}
export
class
TestThreadService
extends
AbstractTestThreadService
implements
IThreadService
{
export
class
TestThreadService
extends
AbstractTestThreadService
{
constructor
(
isMainProcess
:
boolean
=
false
)
{
super
(
isMainProcess
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录