Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
954f86dc
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,发现更多精彩内容 >>
提交
954f86dc
编写于
5月 06, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove workerStatusReporter
上级
48ed2a80
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
4 addition
and
218 deletion
+4
-218
src/vs/editor/browser/editor.all.ts
src/vs/editor/browser/editor.all.ts
+0
-1
src/vs/editor/contrib/workerStatusReporter/browser/workerStatusReporter.css
...rib/workerStatusReporter/browser/workerStatusReporter.css
+0
-28
src/vs/editor/contrib/workerStatusReporter/browser/workerStatusReporter.ts
...trib/workerStatusReporter/browser/workerStatusReporter.ts
+0
-96
src/vs/platform/test/common/nullThreadService.ts
src/vs/platform/test/common/nullThreadService.ts
+1
-8
src/vs/platform/thread/common/extHostThreadService.ts
src/vs/platform/thread/common/extHostThreadService.ts
+1
-9
src/vs/platform/thread/common/mainThreadService.ts
src/vs/platform/thread/common/mainThreadService.ts
+1
-52
src/vs/platform/thread/common/thread.ts
src/vs/platform/thread/common/thread.ts
+0
-15
src/vs/platform/thread/common/workerThreadService.ts
src/vs/platform/thread/common/workerThreadService.ts
+1
-9
未找到文件。
src/vs/editor/browser/editor.all.ts
浏览文件 @
954f86dc
...
...
@@ -40,7 +40,6 @@ import 'vs/editor/contrib/toggleTabFocusMode/common/toggleTabFocusMode';
import
'
vs/editor/contrib/toggleWordWrap/common/toggleWordWrap
'
;
import
'
vs/css!vs/editor/contrib/wordHighlighter/browser/wordHighlighter
'
;
import
'
vs/editor/contrib/wordHighlighter/common/wordHighlighter
'
;
import
'
vs/editor/contrib/workerStatusReporter/browser/workerStatusReporter
'
;
import
'
vs/editor/contrib/defineKeybinding/browser/defineKeybinding
'
;
import
'
vs/editor/contrib/folding/browser/folding
'
;
import
'
vs/editor/contrib/indentation/common/indentation
'
;
...
...
src/vs/editor/contrib/workerStatusReporter/browser/workerStatusReporter.css
已删除
100644 → 0
浏览文件 @
48ed2a80
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-worker-status
.worker
{
display
:
inline-block
;
width
:
1em
;
height
:
1em
;
}
.monaco-worker-status
.worker
[
status
=
unknown
]
:before
{
content
:
'?'
;
}
.monaco-worker-status
.worker
[
status
=
idle
]
:before
{
content
:
'\25CA'
;
color
:
rgb
(
130
,
194
,
130
);
}
.monaco-worker-status
.worker
[
status
=
busy
]
:before
{
content
:
'\2666'
;
}
.monaco-worker-status
.worker
[
status
=
flooded
]
:before
{
content
:
'\2666'
;
color
:
red
;
}
\ No newline at end of file
src/vs/editor/contrib/workerStatusReporter/browser/workerStatusReporter.ts
已删除
100644 → 0
浏览文件 @
48ed2a80
/*---------------------------------------------------------------------------------------------
* 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
'
vs/css!./workerStatusReporter
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
{
IThreadService
,
IThreadServiceStatus
,
IThreadServiceStatusListener
}
from
'
vs/platform/thread/common/thread
'
;
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICodeEditor
,
IOverlayWidgetPosition
,
OverlayWidgetPositionPreference
}
from
'
vs/editor/browser/editorBrowser
'
;
class
WorkerStatusReporter
implements
IEditorContribution
,
IThreadServiceStatusListener
{
public
static
ID
=
'
editor.contrib.workerStatusReporter
'
;
private
_editor
:
ICodeEditor
;
private
_toDispose
:
IDisposable
[];
private
_threadService
:
IThreadService
;
private
_domNode
:
HTMLElement
;
private
_domNodes
:
HTMLElement
[];
constructor
(
editor
:
ICodeEditor
,
@
IThreadService
threadService
:
IThreadService
)
{
this
.
_threadService
=
threadService
;
this
.
_threadService
.
addStatusListener
(
this
);
this
.
_editor
=
editor
;
this
.
_toDispose
=
[];
this
.
_domNodes
=
[];
this
.
_domNode
=
document
.
createElement
(
'
div
'
);
this
.
_domNode
.
className
=
'
monaco-worker-status
'
;
if
(
browser
.
canUseTranslate3d
)
{
// Put the worker reporter in its own layer
this
.
_domNode
.
style
.
transform
=
'
translate3d(0px, 0px, 0px)
'
;
}
this
.
_editor
.
addOverlayWidget
(
this
);
}
public
getId
():
string
{
return
WorkerStatusReporter
.
ID
;
}
public
dispose
():
void
{
this
.
_threadService
.
removeStatusListener
(
this
);
this
.
_toDispose
=
dispose
(
this
.
_toDispose
);
}
public
getDomNode
():
HTMLElement
{
return
this
.
_domNode
;
}
public
getPosition
():
IOverlayWidgetPosition
{
return
{
preference
:
OverlayWidgetPositionPreference
.
TOP_RIGHT_CORNER
};
}
private
_ensureDomNodes
(
desiredCount
:
number
):
void
{
// Remove extra dom nodes
for
(
var
i
=
this
.
_domNodes
.
length
-
1
;
i
>=
desiredCount
;
i
++
)
{
this
.
_domNode
.
removeChild
(
this
.
_domNodes
[
i
]);
this
.
_domNodes
.
splice
(
i
,
1
);
}
// Create new dom nodes
for
(
var
i
=
this
.
_domNodes
.
length
;
i
<
desiredCount
;
i
++
)
{
this
.
_domNodes
[
i
]
=
document
.
createElement
(
'
div
'
);
this
.
_domNodes
[
i
].
className
=
'
worker
'
;
this
.
_domNode
.
appendChild
(
this
.
_domNodes
[
i
]);
}
}
public
onThreadServiceStatus
(
status
:
IThreadServiceStatus
):
void
{
this
.
_ensureDomNodes
(
status
.
workers
.
length
);
for
(
var
i
=
0
;
i
<
status
.
workers
.
length
;
i
++
)
{
var
cnt
=
status
.
workers
[
i
].
queueSize
;
var
workerStatus
=
'
idle
'
;
if
(
cnt
>
5
)
{
workerStatus
=
'
flooded
'
;
}
else
if
(
cnt
>
0
)
{
workerStatus
=
'
busy
'
;
}
attr
(
this
.
_domNodes
[
i
],
'
status
'
,
workerStatus
);
}
}
}
function
attr
(
target
:
HTMLElement
,
attrName
:
string
,
attrValue
:
string
):
void
{
target
.
setAttribute
(
attrName
,
attrValue
);
}
// if (false) { //TODO@Debt
// EditorBrowserRegistry.registerEditorContribution(WorkerStatusReporter);
// }
\ No newline at end of file
src/vs/platform/test/common/nullThreadService.ts
浏览文件 @
954f86dc
...
...
@@ -9,7 +9,7 @@ import abstractThreadService = require('vs/platform/thread/common/abstractThread
import
{
InstantiationService
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
SyncDescriptor0
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
IThreadService
,
IThreadS
erviceStatusListener
,
IThreadS
ynchronizableObject
,
ThreadAffinity
}
from
'
vs/platform/thread/common/thread
'
;
import
{
IThreadService
,
IThreadSynchronizableObject
,
ThreadAffinity
}
from
'
vs/platform/thread/common/thread
'
;
export
class
NullThreadService
extends
abstractThreadService
.
AbstractThreadService
implements
IThreadService
{
public
serviceId
=
IThreadService
;
...
...
@@ -31,13 +31,6 @@ export class NullThreadService extends abstractThreadService.AbstractThreadServi
return
winjs
.
TPromise
.
as
(
null
);
}
addStatusListener
(
listener
:
IThreadServiceStatusListener
):
void
{
// Nothing to do
}
removeStatusListener
(
listener
:
IThreadServiceStatusListener
):
void
{
// Nothing to do
}
protected
_registerAndInstantiateMainProcessActor
<
T
>
(
id
:
string
,
descriptor
:
SyncDescriptor0
<
T
>
):
T
{
return
this
.
_getOrCreateLocalInstance
(
id
,
descriptor
);
...
...
src/vs/platform/thread/common/extHostThreadService.ts
浏览文件 @
954f86dc
...
...
@@ -9,7 +9,7 @@ import remote = require('vs/base/common/remote');
import
descriptors
=
require
(
'
vs/platform/instantiation/common/descriptors
'
);
import
abstractThreadService
=
require
(
'
./abstractThreadService
'
);
import
{
IThreadService
,
IThreadSynchronizableObject
,
ThreadAffinity
,
IThreadServiceStatusListener
}
from
'
vs/platform/thread/common/thread
'
;
import
{
IThreadService
,
IThreadSynchronizableObject
,
ThreadAffinity
}
from
'
vs/platform/thread/common/thread
'
;
export
class
ExtHostThreadService
extends
abstractThreadService
.
AbstractThreadService
implements
IThreadService
{
public
serviceId
=
IThreadService
;
...
...
@@ -29,14 +29,6 @@ export class ExtHostThreadService extends abstractThreadService.AbstractThreadSe
return
TPromise
.
as
(
null
);
}
addStatusListener
(
listener
:
IThreadServiceStatusListener
):
void
{
// Nothing to do
}
removeStatusListener
(
listener
:
IThreadServiceStatusListener
):
void
{
// Nothing to do
}
protected
_registerAndInstantiateMainProcessActor
<
T
>
(
id
:
string
,
descriptor
:
descriptors
.
SyncDescriptor0
<
T
>
):
T
{
return
this
.
_getOrCreateProxyInstance
(
this
.
_remoteCom
,
id
,
descriptor
);
}
...
...
src/vs/platform/thread/common/mainThreadService.ts
浏览文件 @
954f86dc
...
...
@@ -9,11 +9,10 @@ import Worker = require('vs/base/common/worker/workerClient');
import
abstractThreadService
=
require
(
'
vs/platform/thread/common/abstractThreadService
'
);
import
Env
=
require
(
'
vs/base/common/flags
'
);
import
Platform
=
require
(
'
vs/base/common/platform
'
);
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
Timer
=
require
(
'
vs/base/common/timer
'
);
import
remote
=
require
(
'
vs/base/common/remote
'
);
import
{
SyncDescriptor0
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
IThreadService
,
IThreadS
erviceStatusListener
,
IThreadSynchronizableObject
,
ThreadAffinity
,
IThreadServiceStatus
}
from
'
vs/platform/thread/common/thread
'
;
import
{
IThreadService
,
IThreadS
ynchronizableObject
,
ThreadAffinity
}
from
'
vs/platform/thread/common/thread
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
DefaultWorkerFactory
}
from
'
vs/base/worker/defaultWorkerFactory
'
;
...
...
@@ -39,7 +38,6 @@ export class MainThreadService extends abstractThreadService.AbstractThreadServi
private
_workersCreatedPromise
:
TPromise
<
void
>
;
private
_triggerWorkersCreatedPromise
:
(
value
:
void
)
=>
void
;
private
_listeners
:
IThreadServiceStatusListener
[];
private
_workerFactory
:
Worker
.
IWorkerFactory
;
private
_workerModuleId
:
string
;
...
...
@@ -58,7 +56,6 @@ export class MainThreadService extends abstractThreadService.AbstractThreadServi
this
.
_workerPool
=
[];
this
.
_affinityScrambler
=
{};
this
.
_listeners
=
[];
this
.
_workersCreatedPromise
=
new
TPromise
<
void
>
((
c
,
e
,
p
)
=>
{
this
.
_triggerWorkersCreatedPromise
=
c
;
...
...
@@ -90,25 +87,6 @@ export class MainThreadService extends abstractThreadService.AbstractThreadServi
}
}
addStatusListener
(
listener
:
IThreadServiceStatusListener
):
void
{
for
(
let
i
=
0
;
i
<
this
.
_listeners
.
length
;
i
++
)
{
if
(
this
.
_listeners
[
i
]
===
listener
)
{
// listener is already in
return
;
}
}
this
.
_listeners
.
push
(
listener
);
}
removeStatusListener
(
listener
:
IThreadServiceStatusListener
):
void
{
for
(
let
i
=
0
;
i
<
this
.
_listeners
.
length
;
i
++
)
{
if
(
this
.
_listeners
[
i
]
===
listener
)
{
this
.
_listeners
.
splice
(
i
,
1
);
return
;
}
}
}
private
_afterWorkers
():
TPromise
<
void
>
{
let
shouldCancelPromise
=
false
;
...
...
@@ -218,43 +196,14 @@ export class MainThreadService extends abstractThreadService.AbstractThreadServi
let
stopTimer
=
()
=>
{
timerEvent
.
stop
();
// console.log(timerEvent.timeTaken(), this._workerPool.indexOf(worker), obj.getId() + ' >>> ' + methodName + ': ', params);
this
.
_pingListenersIfNecessary
();
};
let
r
=
decoratePromise
(
worker
.
request
(
'
threadService
'
,
[
id
,
methodName
,
params
]),
stopTimer
,
stopTimer
);
this
.
_pingListenersIfNecessary
();
return
r
;
}
private
_pingListenersIfNecessary
():
void
{
if
(
this
.
_listeners
.
length
>
0
)
{
let
status
=
this
.
_buildStatus
();
let
listeners
=
this
.
_listeners
.
slice
(
0
);
try
{
for
(
let
i
=
0
;
i
<
listeners
.
length
;
i
++
)
{
listeners
[
i
].
onThreadServiceStatus
(
status
);
}
}
catch
(
e
)
{
errors
.
onUnexpectedError
(
e
);
}
}
}
private
_buildStatus
():
IThreadServiceStatus
{
let
queueSizes
=
this
.
_workerPool
.
map
((
worker
)
=>
{
return
{
queueSize
:
worker
.
getQueueSize
()
};
});
return
{
workers
:
queueSizes
};
}
protected
_registerAndInstantiateMainProcessActor
<
T
>
(
id
:
string
,
descriptor
:
SyncDescriptor0
<
T
>
):
T
{
return
this
.
_getOrCreateLocalInstance
(
id
,
descriptor
);
}
...
...
src/vs/platform/thread/common/thread.ts
浏览文件 @
954f86dc
...
...
@@ -18,9 +18,6 @@ export interface IThreadService {
// --- BEGIN deprecated methods
isInMainThread
:
boolean
;
addStatusListener
(
listener
:
IThreadServiceStatusListener
):
void
;
removeStatusListener
(
listener
:
IThreadServiceStatusListener
):
void
;
OneWorker
(
obj
:
IThreadSynchronizableObject
,
methodName
:
string
,
target
:
Function
,
param
:
any
[],
affinity
:
ThreadAffinity
):
TPromise
<
any
>
;
AllWorkers
(
obj
:
IThreadSynchronizableObject
,
methodName
:
string
,
target
:
Function
,
param
:
any
[]):
TPromise
<
any
>
;
...
...
@@ -114,15 +111,3 @@ export enum ThreadAffinity {
Group9
=
9
,
All
=
10
}
export
interface
IWorkerStatus
{
queueSize
:
number
;
}
export
interface
IThreadServiceStatus
{
workers
:
IWorkerStatus
[];
}
export
interface
IThreadServiceStatusListener
{
onThreadServiceStatus
(
status
:
IThreadServiceStatus
):
void
;
}
src/vs/platform/thread/common/workerThreadService.ts
浏览文件 @
954f86dc
...
...
@@ -8,7 +8,7 @@ import {TPromise} from 'vs/base/common/winjs.base';
import
abstractThreadService
=
require
(
'
vs/platform/thread/common/abstractThreadService
'
);
import
remote
=
require
(
'
vs/base/common/remote
'
);
import
{
SyncDescriptor0
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
IThreadService
,
IThreadS
erviceStatusListener
,
IThreadS
ynchronizableObject
,
ThreadAffinity
}
from
'
vs/platform/thread/common/thread
'
;
import
{
IThreadService
,
IThreadSynchronizableObject
,
ThreadAffinity
}
from
'
vs/platform/thread/common/thread
'
;
export
class
WorkerThreadService
extends
abstractThreadService
.
AbstractThreadService
implements
IThreadService
{
public
serviceId
=
IThreadService
;
...
...
@@ -56,14 +56,6 @@ export class WorkerThreadService extends abstractThreadService.AbstractThreadSer
return
target
.
apply
(
obj
,
params
);
}
addStatusListener
(
listener
:
IThreadServiceStatusListener
):
void
{
// Nothing to do
}
removeStatusListener
(
listener
:
IThreadServiceStatusListener
):
void
{
// Nothing to do
}
protected
_registerAndInstantiateMainProcessActor
<
T
>
(
id
:
string
,
descriptor
:
SyncDescriptor0
<
T
>
):
T
{
return
this
.
_getOrCreateProxyInstance
(
this
.
_remoteCom
,
id
,
descriptor
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录