Cache Action in advance

master
hadashiA 2023-11-02 09:58:52 +09:00
parent 55be4dba82
commit 0a203c8db9
2 changed files with 6 additions and 6 deletions

View File

@ -102,6 +102,7 @@ namespace Cysharp.Threading.Tasks
AsyncOperationConfiguredSource() AsyncOperationConfiguredSource()
{ {
continuationAction = Continuation;
} }
public static IUniTaskSource Create(AsyncOperation asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token) public static IUniTaskSource Create(AsyncOperation asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token)
@ -123,7 +124,6 @@ namespace Cysharp.Threading.Tasks
if (handleImmediately) if (handleImmediately)
{ {
result.continuationAction = result.Continuation;
asyncOperation.completed += result.continuationAction; asyncOperation.completed += result.continuationAction;
if (cancellationToken.CanBeCanceled) if (cancellationToken.CanBeCanceled)
@ -322,6 +322,7 @@ namespace Cysharp.Threading.Tasks
ResourceRequestConfiguredSource() ResourceRequestConfiguredSource()
{ {
continuationAction = Continuation;
} }
public static IUniTaskSource<UnityEngine.Object> Create(ResourceRequest asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token) public static IUniTaskSource<UnityEngine.Object> Create(ResourceRequest asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token)
@ -343,7 +344,6 @@ namespace Cysharp.Threading.Tasks
if (handleImmediately) if (handleImmediately)
{ {
result.continuationAction = result.Continuation;
asyncOperation.completed += result.continuationAction; asyncOperation.completed += result.continuationAction;
if (cancellationToken.CanBeCanceled) if (cancellationToken.CanBeCanceled)
@ -547,6 +547,7 @@ namespace Cysharp.Threading.Tasks
AssetBundleRequestConfiguredSource() AssetBundleRequestConfiguredSource()
{ {
continuationAction = Continuation;
} }
public static IUniTaskSource<UnityEngine.Object> Create(AssetBundleRequest asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token) public static IUniTaskSource<UnityEngine.Object> Create(AssetBundleRequest asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token)
@ -568,7 +569,6 @@ namespace Cysharp.Threading.Tasks
if (handleImmediately) if (handleImmediately)
{ {
result.continuationAction = result.Continuation;
asyncOperation.completed += result.continuationAction; asyncOperation.completed += result.continuationAction;
if (cancellationToken.CanBeCanceled) if (cancellationToken.CanBeCanceled)
@ -773,6 +773,7 @@ namespace Cysharp.Threading.Tasks
AssetBundleCreateRequestConfiguredSource() AssetBundleCreateRequestConfiguredSource()
{ {
continuationAction = Continuation;
} }
public static IUniTaskSource<AssetBundle> Create(AssetBundleCreateRequest asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token) public static IUniTaskSource<AssetBundle> Create(AssetBundleCreateRequest asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token)
@ -794,7 +795,6 @@ namespace Cysharp.Threading.Tasks
if (handleImmediately) if (handleImmediately)
{ {
result.continuationAction = result.Continuation;
asyncOperation.completed += result.continuationAction; asyncOperation.completed += result.continuationAction;
if (cancellationToken.CanBeCanceled) if (cancellationToken.CanBeCanceled)
@ -1014,6 +1014,7 @@ namespace Cysharp.Threading.Tasks
UnityWebRequestAsyncOperationConfiguredSource() UnityWebRequestAsyncOperationConfiguredSource()
{ {
continuationAction = Continuation;
} }
public static IUniTaskSource<UnityWebRequest> Create(UnityWebRequestAsyncOperation asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token) public static IUniTaskSource<UnityWebRequest> Create(UnityWebRequestAsyncOperation asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token)
@ -1035,7 +1036,6 @@ namespace Cysharp.Threading.Tasks
if (handleImmediately) if (handleImmediately)
{ {
result.continuationAction = result.Continuation;
asyncOperation.completed += result.continuationAction; asyncOperation.completed += result.continuationAction;
if (cancellationToken.CanBeCanceled) if (cancellationToken.CanBeCanceled)

View File

@ -165,6 +165,7 @@ namespace Cysharp.Threading.Tasks
<#= t.typeName #>ConfiguredSource() <#= t.typeName #>ConfiguredSource()
{ {
continuationAction = Continuation;
} }
public static <#= ToIUniTaskSourceReturnType(t.returnType) #> Create(<#= t.typeName #> asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token) public static <#= ToIUniTaskSourceReturnType(t.returnType) #> Create(<#= t.typeName #> asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, bool handleImmediately, CancellationToken cancellationToken, out short token)
@ -186,7 +187,6 @@ namespace Cysharp.Threading.Tasks
if (handleImmediately) if (handleImmediately)
{ {
result.continuationAction = result.Continuation;
asyncOperation.completed += result.continuationAction; asyncOperation.completed += result.continuationAction;
if (cancellationToken.CanBeCanceled) if (cancellationToken.CanBeCanceled)