|
@@ -21,6 +21,7 @@ public partial class WasmExtensionInstance : Extension
|
|
private Memory memory = null!;
|
|
private Memory memory = null!;
|
|
private LayoutBuilder LayoutBuilder { get; set; }
|
|
private LayoutBuilder LayoutBuilder { get; set; }
|
|
private ObjectManager NativeObjectManager { get; set; }
|
|
private ObjectManager NativeObjectManager { get; set; }
|
|
|
|
+ private AsyncCallsManager AsyncHandleManager { get; set; }
|
|
private WasmMemoryUtility WasmMemoryUtility { get; set; }
|
|
private WasmMemoryUtility WasmMemoryUtility { get; set; }
|
|
|
|
|
|
partial void LinkApiFunctions();
|
|
partial void LinkApiFunctions();
|
|
@@ -35,6 +36,10 @@ public partial class WasmExtensionInstance : Extension
|
|
public void Instantiate()
|
|
public void Instantiate()
|
|
{
|
|
{
|
|
NativeObjectManager = new ObjectManager();
|
|
NativeObjectManager = new ObjectManager();
|
|
|
|
+ AsyncHandleManager = new AsyncCallsManager();
|
|
|
|
+ AsyncHandleManager.OnAsyncCallCompleted += OnAsyncCallCompleted;
|
|
|
|
+ AsyncHandleManager.OnAsyncCallFaulted += AsyncHandleManagerOnOnAsyncCallFaulted;
|
|
|
|
+
|
|
LinkApiFunctions();
|
|
LinkApiFunctions();
|
|
Linker.DefineModule(Store, Module);
|
|
Linker.DefineModule(Store, Module);
|
|
|
|
|
|
@@ -43,6 +48,16 @@ public partial class WasmExtensionInstance : Extension
|
|
memory = Instance.GetMemory("memory");
|
|
memory = Instance.GetMemory("memory");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void OnAsyncCallCompleted(int handle, int result)
|
|
|
|
+ {
|
|
|
|
+ Instance.GetAction<int, int>("async_call_completed").Invoke(handle, result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void AsyncHandleManagerOnOnAsyncCallFaulted(int handle, string exceptionMessage)
|
|
|
|
+ {
|
|
|
|
+ Instance.GetAction<int, string>("async_call_faulted").Invoke(handle, exceptionMessage);
|
|
|
|
+ }
|
|
|
|
+
|
|
protected override void OnLoaded()
|
|
protected override void OnLoaded()
|
|
{
|
|
{
|
|
Instance.GetAction("load").Invoke();
|
|
Instance.GetAction("load").Invoke();
|