[wasm] Redesign of managed objects marshaling and lifecycle (#56538)
authorPavel Savara <pavelsavara@microsoft.com>
Sat, 7 Aug 2021 06:06:48 +0000 (08:06 +0200)
committerGitHub <noreply@github.com>
Sat, 7 Aug 2021 06:06:48 +0000 (08:06 +0200)
commite49b9bd7ae706bbcbefc767d6572232acbb20940
tree2173af2a4897d8f92e0ad60acf454ce1b2a09b0f
parent4803ce2c8f7bd335a2e81aa3c312c61707f70b0e
[wasm] Redesign of managed objects marshaling and lifecycle (#56538)

file cycle of JS owned C# instances is driven by FinalizationRegistry

- got rid of Runtime._weakDelegateTable and Runtime._rawToJS
- got rid of JSObject.WeakRawObject and JSObject.RawObject
- GCHandle instead of JSObject double proxy for plain managed ref types
- GCHandle instead of int sequence for delegates + redesign of invocation
- GCHandle for task + redesign of invocation
- improved in-flight retention of thenable/promise and Task
- explicitly delegate type of parameter for EventListener
- moved and renamed some binding functions
- renamed all handles to jsHandle or gcHandle as appropriate
- removed jsHandle math
- cleanup of unused functions
- improved error messages for invalid handles
- more unit tests
12 files changed:
src/libraries/Common/src/Interop/Browser/Interop.Runtime.cs
src/libraries/System.Private.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/AnyRef.cs
src/libraries/System.Private.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/CoreObject.cs
src/libraries/System.Private.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/HostObject.cs
src/libraries/System.Private.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSObject.cs
src/libraries/System.Private.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Runtime.cs
src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System.Private.Runtime.InteropServices.JavaScript.Tests.csproj
src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/DelegateTests.cs
src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/JavaScriptTests.cs
src/mono/wasm/runtime-test.js
src/mono/wasm/runtime/binding_support.js
src/mono/wasm/runtime/corebindings.c