提交 c263bfd5 编写于 作者: S Sam Harwell

Update signature of TryCreateServiceSessionAsync so an optional argument is clear

上级 25943a42
......@@ -59,7 +59,7 @@ public static async Task<RemoteHostClient> CreateAsync(Workspace workspace, bool
public AssetStorage AssetStorage => _inprocServices.AssetStorage;
protected override async Task<Session> TryCreateServiceSessionAsync(string serviceName, Func<CancellationToken, Task<PinnedRemotableDataScope>> getSnapshotAsync, object callbackTarget, CancellationToken cancellationToken)
protected override async Task<Session> TryCreateServiceSessionAsync(string serviceName, Optional<Func<CancellationToken, Task<PinnedRemotableDataScope>>> getSnapshotAsync, object callbackTarget, CancellationToken cancellationToken)
{
// get stream from service hub to communicate snapshot/asset related information
// this is the back channel the system uses to move data between VS and remote host
......
......@@ -31,13 +31,13 @@ internal class JsonRpcSession : RemoteHostClient.Session
private readonly CancellationTokenRegistration _cancellationRegistration;
public static async Task<JsonRpcSession> CreateAsync(
Func<CancellationToken, Task<PinnedRemotableDataScope>> getSnapshotAsync,
Optional<Func<CancellationToken, Task<PinnedRemotableDataScope>>> getSnapshotAsync,
object callbackTarget,
Stream serviceStream,
Stream snapshotStreamOpt,
CancellationToken cancellationToken)
{
var snapshot = getSnapshotAsync == null ? null : await getSnapshotAsync(cancellationToken).ConfigureAwait(false);
var snapshot = getSnapshotAsync.Value == null ? null : await getSnapshotAsync.Value(cancellationToken).ConfigureAwait(false);
JsonRpcSession session;
try
......
......@@ -5,6 +5,7 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Execution;
......@@ -114,11 +115,11 @@ private static async Task RegisterWorkspaceHostAsync(Workspace workspace, Remote
_rpc.StartListening();
}
protected override async Task<Session> TryCreateServiceSessionAsync(string serviceName, Func<CancellationToken, Task<PinnedRemotableDataScope>> getSnapshotAsync, object callbackTarget, CancellationToken cancellationToken)
protected override async Task<Session> TryCreateServiceSessionAsync(string serviceName, Optional<Func<CancellationToken, Task<PinnedRemotableDataScope>>> getSnapshotAsync, object callbackTarget, CancellationToken cancellationToken)
{
// get stream from service hub to communicate snapshot/asset related information
// this is the back channel the system uses to move data between VS and remote host for solution related information
var snapshotStream = getSnapshotAsync == null ? null : await RequestServiceAsync(_hubClient, WellKnownServiceHubServices.SnapshotService, _hostGroup, _timeout, cancellationToken).ConfigureAwait(false);
var snapshotStream = getSnapshotAsync.Value != null ? null : await RequestServiceAsync(_hubClient, WellKnownServiceHubServices.SnapshotService, _hostGroup, _timeout, cancellationToken).ConfigureAwait(false);
// get stream from service hub to communicate service specific information
// this is what consumer actually use to communicate information
......
......@@ -77,7 +77,7 @@ public async Task<Session> TryCreateServiceSessionAsync(string serviceName, Solu
protected abstract void OnDisconnected();
protected abstract Task<Session> TryCreateServiceSessionAsync(string serviceName, Func<CancellationToken, Task<PinnedRemotableDataScope>> getSnapshotAsync, object callbackTarget, CancellationToken cancellationToken);
protected abstract Task<Session> TryCreateServiceSessionAsync(string serviceName, Optional<Func<CancellationToken, Task<PinnedRemotableDataScope>>> getSnapshotAsync, object callbackTarget, CancellationToken cancellationToken);
internal void Shutdown()
{
......@@ -175,7 +175,7 @@ public class NoOpClient : RemoteHostClient
}
protected override Task<Session> TryCreateServiceSessionAsync(
string serviceName, Func<CancellationToken, Task<PinnedRemotableDataScope>> getSnapshotAsync, object callbackTarget, CancellationToken cancellationToken)
string serviceName, Optional<Func<CancellationToken, Task<PinnedRemotableDataScope>>> getSnapshotAsync, object callbackTarget, CancellationToken cancellationToken)
{
return SpecializedTasks.Default<Session>();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册