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

Reduced the number of draw calls on the commit info panel. #8568

Merged
merged 1 commit into from Oct 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 16 additions & 13 deletions GitUI/CommitInfo/CommitInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ private void ReloadCommitInfo()

if (_revision != null && !_revision.IsArtificial)
{
UpdateRevisionInfo();
StartAsyncDataLoad();
}

Expand Down Expand Up @@ -321,37 +320,46 @@ void UpdateCommitMessage()
void StartAsyncDataLoad()
{
var cancellationToken = _asyncLoadCancellation.Next();

var initialRevision = _revision;

ThreadHelper.JoinableTaskFactory.RunAsync(async () => { await LoadLinksForRevisionAsync(initialRevision); }).FileAndForget();

ThreadHelper.JoinableTaskFactory.RunAsync(async () =>
{
var tasks = new List<Task>();

tasks.Add(LoadLinksForRevisionAsync(initialRevision));

// No branch/tag data for artificial commands
if (AppSettings.CommitInfoShowContainedInBranches)
{
cancellationToken.ThrowIfCancellationRequested();
await LoadBranchInfoAsync(initialRevision.ObjectId);

tasks.Add(LoadBranchInfoAsync(initialRevision.ObjectId));
}

if (AppSettings.ShowAnnotatedTagsMessages)
{
cancellationToken.ThrowIfCancellationRequested();
await LoadAnnotatedTagInfoAsync(initialRevision.Refs);

tasks.Add(LoadAnnotatedTagInfoAsync(initialRevision.Refs));
}

if (AppSettings.CommitInfoShowContainedInTags)
{
cancellationToken.ThrowIfCancellationRequested();
await LoadTagInfoAsync(initialRevision.ObjectId);

tasks.Add(LoadTagInfoAsync(initialRevision.ObjectId));
}

if (AppSettings.CommitInfoShowTagThisCommitDerivesFrom)
{
cancellationToken.ThrowIfCancellationRequested();
await LoadDescribeInfoAsync(initialRevision.ObjectId);

tasks.Add(LoadDescribeInfoAsync(initialRevision.ObjectId));
}

await Task.WhenAll(tasks);

UpdateRevisionInfo();
}).FileAndForget();

return;
Expand All @@ -374,7 +382,6 @@ async Task LoadLinksForRevisionAsync(GitRevision revision)

await this.SwitchToMainThreadAsync(cancellationToken);
_linksInfo = linksInfo;
UpdateRevisionInfo();

return;

Expand All @@ -400,7 +407,6 @@ async Task LoadAnnotatedTagInfoAsync(IReadOnlyList<IGitRef> refs)

await this.SwitchToMainThreadAsync(cancellationToken);
_annotatedTagsMessages = annotatedTagsMessages;
UpdateRevisionInfo();

return;

Expand Down Expand Up @@ -463,7 +469,6 @@ async Task LoadTagInfoAsync(ObjectId objectId)

await this.SwitchToMainThreadAsync(cancellationToken);
_tags = tags;
UpdateRevisionInfo();
}

async Task LoadBranchInfoAsync(ObjectId revision)
Expand All @@ -481,7 +486,6 @@ async Task LoadBranchInfoAsync(ObjectId revision)

await this.SwitchToMainThreadAsync(cancellationToken);
_branches = branches;
UpdateRevisionInfo();
}

async Task LoadDescribeInfoAsync(ObjectId commitId)
Expand All @@ -492,7 +496,6 @@ async Task LoadDescribeInfoAsync(ObjectId commitId)

await this.SwitchToMainThreadAsync(cancellationToken);
_gitDescribeInfo = info;
UpdateRevisionInfo();

return;

Expand Down