Skip to content

Commit

Permalink
Merge pull request #12655 from unoplatform/Youssef1313/parser-cancell…
Browse files Browse the repository at this point in the history
…ation

perf: Proper cancellation for XamlFileParser
  • Loading branch information
jeromelaban authored Jun 21, 2023
2 parents 1111f3c + 463d921 commit 2eb2b28
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private static void ScavengeCache()
{
cancellationToken.ThrowIfCancellationRequested();

var xamlFileDefinition = Visit(reader, file.Path, targetFilePath);
var xamlFileDefinition = Visit(reader, file.Path, targetFilePath, cancellationToken);
if (!reader.DisableCaching)
{
_cachedFiles[cachedFileKey] = new CachedFile(DateTimeOffset.Now, xamlFileDefinition);
Expand Down Expand Up @@ -224,14 +224,15 @@ private XmlReader RewriteForXBind(SourceText sourceText)
}
}

private XamlFileDefinition Visit(XamlXmlReader reader, string file, string targetFilePath)
private XamlFileDefinition Visit(XamlXmlReader reader, string file, string targetFilePath, CancellationToken cancellationToken)
{
WriteState(reader);

var xamlFile = new XamlFileDefinition(file, targetFilePath);

do
{
cancellationToken.ThrowIfCancellationRequested();
switch (reader.NodeType)
{
case XamlNodeType.StartObject:
Expand Down

0 comments on commit 2eb2b28

Please sign in to comment.