Refactor code to remove public NativeObject

このコミットが含まれているのは:
Sergio Pedri committed 2022-10-21 03:57:05 -07:00
1 親 2e9da5cf85
コミット 27ca08cf2f
38ファイル変更
+975 -389

検索条件に一致するファイルはありません

+6 -5
ファイルの表示
@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading;
using CommunityToolkit.Diagnostics;
using ComputeSharp.Interop;
#if WINDOWS_UWP
using ComputeSharp.Uwp.Extensions;
#else
@@ -34,7 +35,7 @@ partial class SwapChainManager<TOwner>
// Here and in the calls below, only get a reference tracking lease when starting a render thread.
// This avoids crashes when the panel has been disposed but some code (eg. event handlers) still
// ends up calling into any of the APIs in this file, which is not intended but should not crash.
using Lease _0 = GetReferenceTrackingLease();
using ReferenceTracker.Lease _0 = GetReferenceTracker().GetReferenceTrackingLease();
this.renderCancellationTokenSource?.Cancel();
@@ -79,7 +80,7 @@ partial class SwapChainManager<TOwner>
// If there is a render thread currently running, stop it and restart it
if (this.renderCancellationTokenSource?.IsCancellationRequested == false)
{
using Lease _0 = GetReferenceTrackingLease();
using ReferenceTracker.Lease _0 = GetReferenceTracker().GetReferenceTrackingLease();
this.renderCancellationTokenSource?.Cancel();
@@ -114,7 +115,7 @@ partial class SwapChainManager<TOwner>
if (this.renderCancellationTokenSource?.IsCancellationRequested == false &&
this.isDynamicResolutionEnabled)
{
using Lease _0 = GetReferenceTrackingLease();
using ReferenceTracker.Lease _0 = GetReferenceTracker().GetReferenceTrackingLease();
this.renderCancellationTokenSource?.Cancel();
@@ -187,13 +188,13 @@ partial class SwapChainManager<TOwner>
this.dynamicResolutionScale = this.resolutionScale;
// These two leases are needed to ensure the manager isn't disposed while rendering is running
using Lease _0 = GetReferenceTrackingLease();
using ReferenceTracker.Lease _0 = GetReferenceTracker().GetReferenceTrackingLease();
RenderLoopWithDynamicResolution();
}
else
{
using Lease _0 = GetReferenceTrackingLease();
using ReferenceTracker.Lease _0 = GetReferenceTracker().GetReferenceTrackingLease();
RenderLoop();
}
+2 -2
ファイルの表示
@@ -40,7 +40,7 @@ namespace ComputeSharp.WinUI.Helpers;
/// A type managing rendering on a target swap chain object.
/// </summary>
/// <typeparam name="TOwner">The type of the owner <see cref="SwapChainPanel"/> instance.</typeparam>
internal sealed unsafe partial class SwapChainManager<TOwner> : NativeObject
internal sealed unsafe partial class SwapChainManager<TOwner> : ReferenceTrackedObject
where TOwner : SwapChainPanel
{
/// <summary>
@@ -517,7 +517,7 @@ internal sealed unsafe partial class SwapChainManager<TOwner> : NativeObject
}
/// <inheritdoc/>
private protected override void OnDispose()
protected override void DangerousRelease()
{
static void OnDisposeOnDispatcherQueueThread(SwapChainManager<TOwner> @this)
{