Skip to content

Commit

Permalink
Implements GDTask Tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Delsin-Yu committed Feb 26, 2024
1 parent 7532c18 commit b1db333
Show file tree
Hide file tree
Showing 13 changed files with 619 additions and 732 deletions.
2 changes: 1 addition & 1 deletion GDTask.Nuget.Test
10 changes: 5 additions & 5 deletions GDTask.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GDTask", "GDTask\GDTask.csproj", "{3A8E50C1-6413-4778-BC54-22A610CD1B3B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GDTask.Tests", "GDTask.Tests\GDTask.Tests.csproj", "{F55A976A-61E3-412C-B62C-011BCD6A06AD}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GDTask.Tests", "GDTask.Nuget.Test\GDTask.Tests.csproj", "{CA9BC468-0EEC-4E91-9465-563E4BCFEC54}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -20,9 +20,9 @@ Global
{3A8E50C1-6413-4778-BC54-22A610CD1B3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A8E50C1-6413-4778-BC54-22A610CD1B3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A8E50C1-6413-4778-BC54-22A610CD1B3B}.Release|Any CPU.Build.0 = Release|Any CPU
{F55A976A-61E3-412C-B62C-011BCD6A06AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F55A976A-61E3-412C-B62C-011BCD6A06AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F55A976A-61E3-412C-B62C-011BCD6A06AD}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{F55A976A-61E3-412C-B62C-011BCD6A06AD}.Release|Any CPU.Build.0 = Debug|Any CPU
{CA9BC468-0EEC-4E91-9465-563E4BCFEC54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA9BC468-0EEC-4E91-9465-563E4BCFEC54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA9BC468-0EEC-4E91-9465-563E4BCFEC54}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{CA9BC468-0EEC-4E91-9465-563E4BCFEC54}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
EndGlobal
10 changes: 5 additions & 5 deletions GDTask/GDTask.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@

<Title>GDTask</Title>
<PackageId>GDTask</PackageId>
<PackageVersion>1.0.0</PackageVersion>
<PackageVersion>1.1.0</PackageVersion>
<Authors>DE-YU, Atlinx, Yoshifumi Kawai / Cysharp</Authors>
<Description>Provides an efficient async/await integration to Godot 4.x</Description>
<Description>Provides an efficient async/await integration to Godot 4.1+</Description>
<PackageProjectUrl>https://www.nuget.org/packages/GDTask</PackageProjectUrl>
<PackageIcon>Logo.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/Delsin-Yu/GDTask.Nuget</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>Godot GDTask GodotTask Task Async</PackageTags>
<PackageReleaseNotes>Migrate all APIs under `GodotTask.Tasks` namespace to `GodotTask` root namespace.</PackageReleaseNotes>
<PackageReleaseNotes>Implements `GDTask Tracker` feature, when calling `TaskTracker.ShowTrackerWindow()` in your code base, the GDTask system will create(or reuse) a `GDTask Tracker` window for inspecting / diagnosing (leaked) `GDTasks`.</PackageReleaseNotes>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>

<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -40,7 +40,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GodotSharp" Version="4.0.0"/>
<PackageReference Include="Godot.SourceGenerators" Version="4.0.0"/>
<PackageReference Include="GodotSharp" Version="4.1.0"/>
<PackageReference Include="Godot.SourceGenerators" Version="4.1.0"/>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion GDTask/src/AsyncUnit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace GodotTask

public override string ToString() => "()";

public override bool Equals(object obj) => obj is AsyncUnit;
public override bool Equals(object? obj) => obj is AsyncUnit;

public static bool operator ==(AsyncUnit left, AsyncUnit right) => true;

Expand Down
256 changes: 0 additions & 256 deletions GDTask/src/Internal/DiagnosticsExtensions.cs

This file was deleted.

55 changes: 55 additions & 0 deletions GDTask/src/Internal/TaskTracker.Models.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;

namespace GodotTask;

public static partial class TaskTracker
{
internal record TrackingData(string FormattedType, int TrackingId, DateTime AddTime, string StackTrace, Func<GDTaskStatus> StatusProvider);

internal class ObservableProperty : IObservable<bool>
{
public static implicit operator bool(ObservableProperty observableProperty)
{
return observableProperty._value;
}

public ObservableProperty(bool value)
{
_value = value;
}

public bool Value
{
get => _value;
set
{
_value = value;

if (_singleSubscriber is null) return;

_singleSubscriber.OnNext(_value);
_singleSubscriber.OnCompleted();
}
}

private IObserver<bool>? _singleSubscriber;

private bool _value;

public IDisposable Subscribe(IObserver<bool> observer)
{
_singleSubscriber = observer;
observer.OnNext(_value);
return new DisposeHandle(this);
}

internal class DisposeHandle : IDisposable
{
private readonly ObservableProperty _property;

public DisposeHandle(ObservableProperty property) => _property = property;

public void Dispose() => _property._singleSubscriber = null;
}
}
}
Loading

0 comments on commit b1db333

Please sign in to comment.