Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid extra JTF collection/factory #9623

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ internal sealed class LanguageServiceHost : OnceInitializedOnceDisposedAsync, IP
private readonly IUnconfiguredProjectTasksService _tasksService;
private readonly ISafeProjectGuidService _projectGuidService;
private readonly IProjectFaultHandlerService _projectFaultHandler;
private readonly JoinableTaskCollection _joinableTaskCollection;
private readonly JoinableTaskFactory _joinableTaskFactory;
private readonly AsyncLazy<bool> _isEnabled;

private DisposableBag? _disposables;
Expand Down Expand Up @@ -88,10 +86,6 @@ public LanguageServiceHost(
|| await vsShell.IsPopulateSolutionCacheModeAsync();
},
threadingService.JoinableTaskFactory);

_joinableTaskCollection = threadingService.JoinableTaskContext.CreateCollection();
_joinableTaskCollection.DisplayName = "LanguageServiceHostTasks";
_joinableTaskFactory = new JoinableTaskFactory(_joinableTaskCollection);
}

public Task LoadAsync()
Expand Down Expand Up @@ -175,7 +169,7 @@ protected override async Task InitializeCoreAsync(CancellationToken cancellation
linkOptions: DataflowOption.PropagateCompletion,
cancellationToken: cancellationToken),

ProjectDataSources.JoinUpstreamDataSources(_joinableTaskFactory, _projectFaultHandler, _activeConfiguredProjectProvider, _activeConfigurationGroupSubscriptionService),
ProjectDataSources.JoinUpstreamDataSources(JoinableFactory, _projectFaultHandler, _activeConfiguredProjectProvider, _activeConfigurationGroupSubscriptionService),

new DisposableDelegate(() =>
{
Expand Down Expand Up @@ -211,7 +205,7 @@ async Task OnSlicesChangedAsync(IProjectVersionedValue<(ConfiguredProject Active
Guid projectGuid = await _projectGuidService.GetProjectGuidAsync(cancellationToken);

// New slice. Create a workspace for it.
workspace = _workspaceFactory.Create(source, slice, _joinableTaskCollection, _joinableTaskFactory, projectGuid, cancellationToken);
workspace = _workspaceFactory.Create(source, slice, JoinableCollection, JoinableFactory, projectGuid, cancellationToken);

if (workspace is null)
{
Expand Down Expand Up @@ -282,7 +276,7 @@ public async Task WhenInitialized(CancellationToken token)
{
await ValidateEnabledAsync(token);

using (_joinableTaskCollection.Join())
using (JoinableCollection.Join())
{
await _firstPrimaryWorkspaceSet.Task.WithCancellation(token);
}
Expand Down Expand Up @@ -350,7 +344,7 @@ public async Task AfterLoadInitialConfigurationAsync()
// Ensure the project is not considered loaded until our first publication.
Task result = _tasksService.PrioritizedProjectLoadedInHostAsync(async () =>
{
using (_joinableTaskCollection.Join())
using (JoinableCollection.Join())
{
await WhenInitialized(_tasksService.UnloadCancellationToken);
}
Expand Down
Loading