Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
5fad72f
Add placeholder support and concurrency tests for Future<T> class
IvanMurzak Feb 12, 2025
061adc2
Fixed bugs
IvanMurzak Feb 13, 2025
d9498ec
Added timeout to test `Load_X_ReferencesInParallelLateDispose`
IvanMurzak Feb 13, 2025
3ce405a
Enhance test setup and teardown with debug messages and assertions fo…
IvanMurzak Feb 13, 2025
2dfe5c6
Add new utility classes and update logging mechanism in Future<T> imp…
IvanMurzak Feb 14, 2025
e0956ba
Adding dedicated Texture loading and cache
IvanMurzak Feb 14, 2025
2746db3
Refactor Future<T> classes and update debug level to Trace for improv…
IvanMurzak Feb 15, 2025
a4b4b47
Fixed compilation error on UNITY_2020_1_OR_NEWER
IvanMurzak Feb 15, 2025
4399ed7
Refactor logging messages in Future<T> and ImageLoader classes for cl…
IvanMurzak Feb 15, 2025
636f1b5
Add WEBGL platform to VSCode settings for improved compatibility
IvanMurzak Feb 15, 2025
82be07f
Refactor logging messages in Disk and Memory cache classes for consis…
IvanMurzak Feb 15, 2025
a1d8226
Refactor logging messages in ImageLoader and Reference classes for im…
IvanMurzak Feb 15, 2025
1fd84fa
Refactor logging levels in ImageLoader classes for improved clarity; …
IvanMurzak Feb 15, 2025
9eeeca5
Rename cache clearing methods for consistency; update references in t…
IvanMurzak Feb 15, 2025
31e3cd3
Refactor Future class constructor to use default cancellation token; …
IvanMurzak Feb 15, 2025
3c114a1
Add tests for DisposeOnOutOfScope and DisposeOnOutOfScopeAll methods;…
IvanMurzak Feb 15, 2025
f5f94e2
Fix XML documentation for LoadSpriteRef method to ensure consistent r…
IvanMurzak Feb 15, 2025
af53378
Enhance Future class by adding weak references for improved memory ma…
IvanMurzak Feb 15, 2025
4081859
Add org.nuget.scriban package and update scoped registries in manifes…
IvanMurzak Feb 15, 2025
10eae9f
Added UnityNuGet
IvanMurzak Feb 15, 2025
b8e2ee9
Add tests for ImageLoader events order and implement FakeConsumer uti…
IvanMurzak Feb 15, 2025
8808964
Added Moq
IvanMurzak Feb 15, 2025
5f35f7a
Update project settings and package versions to Unity 2019.4.40f1 and…
IvanMurzak Feb 15, 2025
27e0df5
Refactor memory cache clearing logic for better clarity and maintaina…
IvanMurzak Feb 15, 2025
614b3ec
Refactor memory cache clearing logic to include FutureSprite for impr…
IvanMurzak Feb 15, 2025
bf156fb
Merge pull request #27 from IvanMurzak:feature/moq
IvanMurzak Feb 15, 2025
3c8175b
Add FutureAwaiter and update Future API to use interfaces for better …
IvanMurzak Feb 17, 2025
7e407a2
Testing Future callbacks, better logging, improved callbacks behaviour
IvanMurzak Feb 18, 2025
640f8cf
Update TestFuture to expect warning on future cancellation
IvanMurzak Feb 18, 2025
04d2df1
Enhance Future API and memory cache management with logging improveme…
IvanMurzak Feb 18, 2025
0655c33
Refactor Future API for improved memory management and logging; updat…
IvanMurzak Feb 18, 2025
a82a435
Refactor AsUniTask and AsTask methods for improved completion handlin…
IvanMurzak Feb 18, 2025
efeb854
Remove unused namespaces from TestFutureMoq to clean up code
IvanMurzak Feb 18, 2025
f0b7119
Clean up FakeFuture implementation by removing commented-out code and…
IvanMurzak Feb 18, 2025
a9c17fd
Add TestFutureOrder class and refactor image URL handling in tests
IvanMurzak Feb 18, 2025
edd91ff
Update TestFutureInLine and TestFutureOrder to improve timeout handli…
IvanMurzak Feb 18, 2025
02c5a40
Merge pull request #28 from IvanMurzak:test/moq
IvanMurzak Feb 18, 2025
7a8e839
Refactor error logging to use property Id instead of field id in Imag…
IvanMurzak Feb 18, 2025
9e9e701
Refactor test timeout handling to use UniTask.WaitUntil for task comp…
IvanMurzak Feb 18, 2025
8ddc656
Remove Moq package and update dependencies in manifest and lock files
IvanMurzak Feb 19, 2025
56475b5
Add FutureEx utility and refactor loading methods for improved event …
IvanMurzak Feb 19, 2025
d558ead
Refactor test cases for loading from disk cache and source to improve…
IvanMurzak Feb 19, 2025
511073d
Refactor test cases for disk cache loading to improve cancellation ha…
IvanMurzak Feb 19, 2025
b93a582
Refactor test cases to improve garbage collection handling and introd…
IvanMurzak Feb 19, 2025
383352d
Fixed memory cleaning in tests. Refactor test method names for consis…
IvanMurzak Feb 19, 2025
27fdbac
Add test classes and refactor existing tests to inherit from base Tes…
IvanMurzak Feb 19, 2025
91e0a5c
Add new test cases for loading failures and enhance logging in Future…
IvanMurzak Feb 19, 2025
3352ffd
Enhance ImageLoader settings with detailed documentation for properti…
IvanMurzak Feb 19, 2025
fa4c774
Added TestFutureWaitingAnotherFuture
IvanMurzak Feb 19, 2025
829bde2
Add tests for loading and cancellation scenarios in Future class
IvanMurzak Feb 20, 2025
fb682d2
Moved and restored Samples
IvanMurzak Feb 20, 2025
eec6e08
Refactor Future.API.cs by removing unused code and enhancing document…
IvanMurzak Feb 20, 2025
bdd3db0
Add AsCoroutine method to IFuture interface and update tests to use U…
IvanMurzak Feb 20, 2025
9a18ee2
Rename ClearRef methods to ClearSpriteRef and ClearTextureRef for cla…
IvanMurzak Feb 20, 2025
0878133
Add tests for loading sprites and textures with various caching strat…
IvanMurzak Feb 20, 2025
62308d2
Refactor code by removing unused using directives and consolidating n…
IvanMurzak Feb 20, 2025
7d2c5a8
Enhance image loading methods by renaming parameters for clarity; add…
IvanMurzak Feb 20, 2025
ccf1204
Add sample scripts for loading sprites and textures; update existing …
IvanMurzak Feb 20, 2025
30922f2
Update README to enhance clarity on image loading, cancellation, and …
IvanMurzak Feb 20, 2025
c6c8ccb
Enhance IFuture interface to implement IDisposable; add DisposeOn met…
IvanMurzak Feb 20, 2025
e50fab8
Updated README
IvanMurzak Feb 20, 2025
c792d82
Updated README
IvanMurzak Feb 20, 2025
b92ae06
Refactor error handling order in Future.cs to improve clarity and mai…
IvanMurzak Feb 20, 2025
3c5aeac
Refactor Future API and tests to improve memory management and event …
IvanMurzak Feb 20, 2025
f7b06c8
Improving tests stability
IvanMurzak Feb 20, 2025
190319e
Refactor Future and ImageLoader to enhance method visibility and impr…
IvanMurzak Feb 21, 2025
f0be092
At the end of each test letting async tasks 10 ticks to complete
IvanMurzak Feb 21, 2025
9148657
Update README.md
IvanMurzak Feb 21, 2025
52d6bea
Improved tests stability. Improved Future task conversion
IvanMurzak Feb 21, 2025
6fa3813
Improved memory release null check
IvanMurzak Feb 21, 2025
6ae9c08
Change log level from Debug to Trace for memory release logging in Fu…
IvanMurzak Feb 21, 2025
0805cf7
Disabled log stacktrace for Log and Warning
IvanMurzak Feb 21, 2025
76a3759
Fixed warning conditions. Improvements, stability updates.
IvanMurzak Feb 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@
"ARGB",
"cysharp",
"editmode",
"Finalizers",
"imageloader",
"Murzak",
"openupm",
"ugui",
"unitask"
"unitask",
"WEBGL"
],
"dotnet.defaultSolution": "Unity-ImageLoader.sln"
}
658 changes: 458 additions & 200 deletions Assets/_PackageRoot/Documentation~/README.md

Large diffs are not rendered by default.

Binary file added Assets/_PackageRoot/Editor/Gizmos/icon-cancel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
140 changes: 140 additions & 0 deletions Assets/_PackageRoot/Editor/Gizmos/icon-cancel.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

658 changes: 458 additions & 200 deletions Assets/_PackageRoot/README.md

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using UnityEngine;

namespace Extensions.Unity.ImageLoader
{
public abstract class ComponentTrigger : MonoBehaviour
{
// protected WeakAction onTrigger = new WeakAction();
protected event Action onTrigger;
protected bool isTriggered;

protected void Trigger()
{
isTriggered = true;
onTrigger?.Invoke();
onTrigger = null;
}
public void RegisterCancel<T>(IFuture<T> future)
{
if (future.Status == FutureStatus.Disposed || future.IsCompleted)
return; // ignore completed futures

if (isTriggered)
{
future.Cancel();
return;
}

// TODO: check if future is completed during the onTrigger event
// onTrigger += future.Cancel;
// -------------------------------------------------------------
var weakFuture = new WeakReference<IFuture<T>>(future);
onTrigger += () =>
{
if (weakFuture.TryGetTarget(out var target))
{
if (future.Status == FutureStatus.Disposed || target.IsCompleted)
return; // ignore completed futures

target.Cancel();
}
};
}

public void RegisterDispose<T>(Reference<T> reference)
{
if (reference.IsDisposed)
return; // ignore disposed references

if (isTriggered)
{
reference.Dispose();
return;
}

// TODO: check if reference is disposed during the onTrigger event
// onTrigger += reference.Dispose;
// -------------------------------------------------------------
var weakReference = new WeakReference<Reference<T>>(reference);
onTrigger += () =>
{
if (weakReference.TryGetTarget(out var target))
{
if (target.IsDisposed)
return; // ignore disposed references

target.Dispose();
}
};
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Extensions.Unity.ImageLoader
{
internal class ComponentCancelOnDestroy : ComponentCancelOn
internal class ComponentTriggerOnDestroy : ComponentTrigger
{
private void OnDestroy() => Trigger();
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Extensions.Unity.ImageLoader
{
internal class ComponentCancelOnDisable : ComponentCancelOn
internal class ComponentTriggerOnDisable : ComponentTrigger
{
private void OnDisable() => Trigger();
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Extensions.Unity.ImageLoader
{
internal class ComponentCancelOnEnable : ComponentCancelOn
internal class ComponentTriggerOnEnable : ComponentTrigger
{
private void OnEnable() => Trigger();
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions Assets/_PackageRoot/Runtime/Future/Future.API.Set.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public partial class Future<T> : IDisposable
/// </summary>
/// <param name="value">new value</param>
/// <returns>Returns the Future instance</returns>
public Future<T> SetUseDiskCache(bool value = true)
public IFuture<T> SetUseDiskCache(bool value = true)
{
UseDiskCache = value;
return this;
Expand All @@ -20,10 +20,21 @@ public Future<T> SetUseDiskCache(bool value = true)
/// </summary>
/// <param name="value">new value</param>
/// <returns>Returns the Future instance</returns>
public Future<T> SetUseMemoryCache(bool value = true)
public IFuture<T> SetUseMemoryCache(bool value = true)
{
UseMemoryCache = value;
return this;
}

/// <summary>
/// Set log level for this Future instance
/// </summary>
/// <param name="value">new value</param>
/// <returns>Returns the Future instance</returns>
public IFuture<T> SetLogLevel(DebugLevel value)
{
LogLevel = value;
return this;
}
}
}
Loading