提交 f30b423f 编写于 作者: C Cyrus Najmabadi

Make the IsLowPriority API take a cancellation token as well.

上级 d9dd7092
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
......@@ -16,6 +13,6 @@ internal interface IWorkCoordinatorPriorityService : ILanguageService
/// contained in, and should have work scheduled for it happen after all other documents
/// in the project.
/// </summary>
Task<bool> IsLowPriorityAsync(Document document);
Task<bool> IsLowPriorityAsync(Document document, CancellationToken cancellationToken);
}
}
......@@ -363,7 +363,7 @@ public async Task EnqueueWorkItemAsync(Document document)
// call to this method is serialized. and only this method does the writing.
var priorityService = document.GetLanguageService<IWorkCoordinatorPriorityService>();
var isLowPriority = priorityService != null && await priorityService.IsLowPriorityAsync(document).ConfigureAwait(false);
var isLowPriority = priorityService != null && await priorityService.IsLowPriorityAsync(document, this.CancellationToken).ConfigureAwait(false);
_processor.Enqueue(
new WorkItem(document.Id, document.Project.Language, InvocationReasons.SemanticChanged,
......
......@@ -6,7 +6,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Extensions;
......@@ -397,7 +396,7 @@ private async Task EnqueueWorkItemAsync(Document document, InvocationReasons inv
_shutdownToken.ThrowIfCancellationRequested();
var priorityService = document.GetLanguageService<IWorkCoordinatorPriorityService>();
var isLowPriority = priorityService != null && await priorityService.IsLowPriorityAsync(document).ConfigureAwait(false);
var isLowPriority = priorityService != null && await priorityService.IsLowPriorityAsync(document, _shutdownToken).ConfigureAwait(false);
var currentMember = GetSyntaxPath(changedMember);
......@@ -448,7 +447,7 @@ private async Task EnqueueWorkItemAsync(IIncrementalAnalyzer analyzer, IEnumerab
}
var priorityService = document.GetLanguageService<IWorkCoordinatorPriorityService>();
var isLowPriority = priorityService != null && await priorityService.IsLowPriorityAsync(document).ConfigureAwait(false);
var isLowPriority = priorityService != null && await priorityService.IsLowPriorityAsync(document, _shutdownToken).ConfigureAwait(false);
_documentAndProjectWorkerProcessor.Enqueue(
new WorkItem(documentId, document.Project.Language, InvocationReasons.Reanalyze,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册