Uh oh!
There was an error while loading. Please reload this page.
[browser][wasm] Implement JavaScript managed object reference counting - #37417
Conversation
- This still needs to have the code implement nullable
…http-interop # Conflicts: # src/libraries/System.Net.Http/src/System.Net.Http.csproj
- Throws `PlatformNotSupportedException` for properties and methods of the HttpMessageHandler abstract implementation.
- Addresses commit comments.
- For all of these vars, please replace them with the actual type, except when the type is obvious from a new or explicit cast on the right-hand side.
- Address review comments
Co-Authored-By: Marek Safar <marek.safar@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…reference-counting # Conflicts: # src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/AnyRef.cs # src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Runtime.cs
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| else | ||
| { | ||
| Console.WriteLine($"\tSafeHandleReleaseByHandle: did not find active target {jsId} / target: {reference.Target}"); |
There was a problem hiding this comment.
Why are these not asserts?
Uh oh!
There was an error while loading. Please reload this page.
Wrap the javascript handle in a SafeHandleZeroOrMinusOneIsInvalid implementation.
AnyRef
AnyRefto be abstract and deriving fromSafeHandleZeroOrMinusOneIsInvalidownsHandleGCHandle.Alloccreates a normal allocation or a weak allocation depending on the ownsHandle value passed.JSObject
ReleaseHandlethat is overridden fromAnyRefDisposeand Finalizers definitions from the objects. This will be taken care of byAnyRefwhich derives fromSafeHandleZeroOrMinusOneIsInvalidownsHandleRuntime
_boundObjectsdictionary that tracks all the objects that have been bound from JavaScript objects to managed code is now aWeakReference.binding_supportlib.JSObject.Add support for marshaling the
AnyRefSafeHandle.JSObjectreference handle is incremented.JSObjectreference is decremented.GlobalObjectwhere the object is set withownsHandle= false so that it is not released.Support freeing delegates marshaled to the bindings.
Every delegate that was passed to the bindings code was kept forever causing leaks.
Delegates are now not kept alive when GC'd.
Delegates using lambda expressions forced the developer to explicitly free the delegate.
FreeObject (foreachAction);If a delegate is collected and the javascript code calls that delegate function an exception is thrown instead of inexplicably crashing with null exception error.