Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
9e0406ea
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9e0406ea
编写于
7月 08, 2020
作者:
G
Gen Lu
提交者:
GitHub
7月 08, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #45764 from genlu/noop
No-op SymbolSearchUpdateEngine on non-Windows OS
上级
6ebca394
f64c29a5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
8 deletion
+39
-8
src/EditorFeatures/Core/SymbolSearch/SymbolSearchUpdateEngine.cs
...torFeatures/Core/SymbolSearch/SymbolSearchUpdateEngine.cs
+3
-0
src/EditorFeatures/Core/SymbolSearch/SymbolSearchUpdateEngineFactory.cs
...ures/Core/SymbolSearch/SymbolSearchUpdateEngineFactory.cs
+33
-4
src/Workspaces/Remote/ServiceHub/Services/RemoteSymbolSearchUpdateEngine.cs
...ote/ServiceHub/Services/RemoteSymbolSearchUpdateEngine.cs
+3
-4
未找到文件。
src/EditorFeatures/Core/SymbolSearch/SymbolSearchUpdateEngine.cs
浏览文件 @
9e0406ea
...
...
@@ -30,6 +30,9 @@ internal partial class SymbolSearchUpdateEngine : ISymbolSearchUpdateEngine
private
readonly
ConcurrentDictionary
<
string
,
IAddReferenceDatabaseWrapper
>
_sourceToDatabase
=
new
ConcurrentDictionary
<
string
,
IAddReferenceDatabaseWrapper
>();
/// <summary>
/// Don't call directly. Use <see cref="SymbolSearchUpdateEngineFactory"/> instead.
/// </summary>
public
SymbolSearchUpdateEngine
(
ISymbolSearchLogService
logService
,
ISymbolSearchProgressService
progressService
)
...
...
src/EditorFeatures/Core/SymbolSearch/SymbolSearchUpdateEngineFactory.cs
浏览文件 @
9e0406ea
...
...
@@ -4,13 +4,12 @@
#
nullable
enable
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.Runtime.InteropServices
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.Remote
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.SymbolSearch
{
...
...
@@ -19,6 +18,9 @@ namespace Microsoft.CodeAnalysis.SymbolSearch
/// implementation produces an engine that will run in-process. Implementations at
/// other layers can behave differently (for example, running the engine out-of-process).
/// </summary>
/// <remarks>
/// This returns an No-op engine on non-Windows OS, because the backing storage depends on Windows APIs.
/// </remarks>
internal
static
partial
class
SymbolSearchUpdateEngineFactory
{
public
static
async
Task
<
ISymbolSearchUpdateEngine
>
CreateEngineAsync
(
...
...
@@ -36,10 +38,37 @@ internal static partial class SymbolSearchUpdateEngineFactory
}
// Couldn't go out of proc. Just do everything inside the current process.
return
new
SymbolSearchUpdateEngine
(
logService
,
progressService
);
return
CreateEngineInProcess
(
logService
,
progressService
);
}
private
sealed
partial
class
RemoteUpdateEngine
:
ISymbolSearchUpdateEngine
/// <summary>
/// This returns a No-op engine if called on non-Windows OS, because the backing storage depends on Windows APIs.
/// </summary>
public
static
ISymbolSearchUpdateEngine
CreateEngineInProcess
(
ISymbolSearchLogService
logService
,
ISymbolSearchProgressService
progressService
)
{
return
RuntimeInformation
.
IsOSPlatform
(
OSPlatform
.
Windows
)
?
new
SymbolSearchUpdateEngine
(
logService
,
progressService
)
:
(
ISymbolSearchUpdateEngine
)
new
NoOpUpdateEngine
();
}
private
sealed
class
NoOpUpdateEngine
:
ISymbolSearchUpdateEngine
{
public
Task
<
ImmutableArray
<
PackageWithAssemblyResult
>>
FindPackagesWithAssemblyAsync
(
string
source
,
string
assemblyName
,
CancellationToken
cancellationToken
)
=>
Task
.
FromResult
(
ImmutableArray
<
PackageWithAssemblyResult
>.
Empty
);
public
Task
<
ImmutableArray
<
PackageWithTypeResult
>>
FindPackagesWithTypeAsync
(
string
source
,
string
name
,
int
arity
,
CancellationToken
cancellationToken
)
=>
Task
.
FromResult
(
ImmutableArray
<
PackageWithTypeResult
>.
Empty
);
public
Task
<
ImmutableArray
<
ReferenceAssemblyWithTypeResult
>>
FindReferenceAssembliesWithTypeAsync
(
string
name
,
int
arity
,
CancellationToken
cancellationToken
)
=>
Task
.
FromResult
(
ImmutableArray
<
ReferenceAssemblyWithTypeResult
>.
Empty
);
public
Task
UpdateContinuouslyAsync
(
string
sourceName
,
string
localSettingsDirectory
)
=>
Task
.
CompletedTask
;
}
private
sealed
class
RemoteUpdateEngine
:
ISymbolSearchUpdateEngine
{
private
readonly
SemaphoreSlim
_gate
=
new
SemaphoreSlim
(
initialCount
:
1
);
...
...
src/Workspaces/Remote/ServiceHub/Services/RemoteSymbolSearchUpdateEngine.cs
浏览文件 @
9e0406ea
...
...
@@ -13,14 +13,13 @@ namespace Microsoft.CodeAnalysis.Remote
{
internal
partial
class
RemoteSymbolSearchUpdateEngine
:
ServiceBase
,
IRemoteSymbolSearchUpdateEngine
,
ISymbolSearchLogService
,
ISymbolSearchProgressService
{
private
readonly
SymbolSearchUpdateEngine
_updateEngine
;
private
readonly
I
SymbolSearchUpdateEngine
_updateEngine
;
public
RemoteSymbolSearchUpdateEngine
(
Stream
stream
,
IServiceProvider
serviceProvider
)
:
base
(
serviceProvider
,
stream
)
{
_updateEngine
=
new
SymbolSearchUpdateEngine
(
logService
:
this
,
progressService
:
this
);
_updateEngine
=
SymbolSearchUpdateEngineFactory
.
CreateEngineInProcess
(
logService
:
this
,
progressService
:
this
);
StartService
();
}
...
...
@@ -32,7 +31,7 @@ public Task UpdateContinuouslyAsync(string sourceName, string localSettingsDirec
// In non-test scenarios, we're not cancellable. Our lifetime will simply be that
// of the OOP process itself. i.e. when it goes away, it will just tear down our
// update-loop itself. So we don't need any additional controls over it.
return
_updateEngine
.
UpdateContinuouslyAsync
(
sourceName
,
localSettingsDirectory
,
CancellationToken
.
None
);
return
_updateEngine
.
UpdateContinuouslyAsync
(
sourceName
,
localSettingsDirectory
);
},
CancellationToken
.
None
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录