@@ -31,24 +31,24 @@ let _next_gcv_handle = -2;
3131// GCVHandle is like GCHandle, but it's not tracked and allocated by the mono GC, but just by JS.
3232// It's used when we need to create GCHandle-like identity ahead of time, before calling Mono.
3333// they have negative values, so that they don't collide with GCHandles.
34- export function alloc_gcv_handle ( ) : GCHandle {
34+ export function alloc_gcv_handle ( ) : GCHandle {
3535 const gcv_handle = _gcv_handle_free_list . length ? _gcv_handle_free_list . pop ( ) : _next_gcv_handle -- ;
3636 return gcv_handle as any ;
3737}
3838
39- export function free_gcv_handle ( gcv_handle : GCHandle ) : void {
39+ export function free_gcv_handle ( gcv_handle : GCHandle ) : void {
4040 _gcv_handle_free_list . push ( gcv_handle ) ;
4141}
4242
43- export function is_jsv_handle ( js_handle : JSHandle ) : boolean {
43+ export function is_jsv_handle ( js_handle : JSHandle ) : boolean {
4444 return ( js_handle as any ) < - 1 ;
4545}
4646
47- export function is_js_handle ( js_handle : JSHandle ) : boolean {
47+ export function is_js_handle ( js_handle : JSHandle ) : boolean {
4848 return ( js_handle as any ) > 0 ;
4949}
5050
51- export function is_gcv_handle ( gc_handle : GCHandle ) : boolean {
51+ export function is_gcv_handle ( gc_handle : GCHandle ) : boolean {
5252 return ( gc_handle as any ) < - 1 ;
5353}
5454
@@ -62,15 +62,15 @@ export const cs_owned_js_handle_symbol = Symbol.for("wasm cs_owned_js_handle");
6262export const do_not_force_dispose = Symbol . for ( "wasm do_not_force_dispose" ) ;
6363
6464
65- export function mono_wasm_get_jsobj_from_js_handle ( js_handle : JSHandle ) : any {
65+ export function mono_wasm_get_jsobj_from_js_handle ( js_handle : JSHandle ) : any {
6666 if ( is_js_handle ( js_handle ) )
6767 return _cs_owned_objects_by_js_handle [ < any > js_handle ] ;
6868 if ( is_jsv_handle ( js_handle ) )
6969 return _cs_owned_objects_by_jsv_handle [ 0 - < any > js_handle ] ;
7070 return null ;
7171}
7272
73- export function mono_wasm_get_js_handle ( js_obj : any ) : JSHandle {
73+ export function mono_wasm_get_js_handle ( js_obj : any ) : JSHandle {
7474 assert_js_interop ( ) ;
7575 if ( js_obj [ cs_owned_js_handle_symbol ] ) {
7676 return js_obj [ cs_owned_js_handle_symbol ] ;
@@ -94,7 +94,7 @@ export function mono_wasm_get_js_handle (js_obj: any): JSHandle {
9494 return js_handle as JSHandle ;
9595}
9696
97- export function register_with_jsv_handle ( js_obj : any , jsv_handle : JSHandle ) {
97+ export function register_with_jsv_handle ( js_obj : any , jsv_handle : JSHandle ) {
9898 assert_js_interop ( ) ;
9999 // note _cs_owned_objects_by_js_handle is list, not Map. That's why we maintain _js_handle_free_list.
100100 _cs_owned_objects_by_jsv_handle [ 0 - < any > jsv_handle ] = js_obj ;
@@ -105,7 +105,7 @@ export function register_with_jsv_handle (js_obj: any, jsv_handle: JSHandle) {
105105}
106106
107107// note: in MT, this is called from locked JSProxyContext. Don't call anything that would need locking.
108- export function SystemInteropJS_ReleaseCSOwnedObject ( js_handle : JSHandle ) : void {
108+ export function SystemInteropJS_ReleaseCSOwnedObject ( js_handle : JSHandle ) : void {
109109 let obj : any ;
110110 if ( is_js_handle ( js_handle ) ) {
111111 obj = _cs_owned_objects_by_js_handle [ < any > js_handle ] ;
@@ -122,7 +122,7 @@ export function SystemInteropJS_ReleaseCSOwnedObject (js_handle: JSHandle): void
122122 }
123123}
124124
125- export function setup_managed_proxy ( owner : any , gc_handle : GCHandle ) : void {
125+ export function setup_managed_proxy ( owner : any , gc_handle : GCHandle ) : void {
126126 assert_js_interop ( ) ;
127127 // keep the gc_handle so that we could easily convert it back to original C# object for roundtrip
128128 owner [ js_owned_gc_handle_symbol ] = gc_handle ;
@@ -139,15 +139,15 @@ export function setup_managed_proxy (owner: any, gc_handle: GCHandle): void {
139139 _js_owned_object_table . set ( gc_handle , wr ) ;
140140}
141141
142- export function upgrade_managed_proxy_to_strong_ref ( owner : any , gc_handle : GCHandle ) : void {
142+ export function upgrade_managed_proxy_to_strong_ref ( owner : any , gc_handle : GCHandle ) : void {
143143 const sr = create_strong_ref ( owner ) ;
144144 if ( _use_finalization_registry ) {
145145 _js_owned_object_registry . unregister ( owner ) ;
146146 }
147147 _js_owned_object_table . set ( gc_handle , sr ) ;
148148}
149149
150- export function teardown_managed_proxy ( owner : any , gc_handle : GCHandle , skipManaged ?: boolean ) : void {
150+ export function teardown_managed_proxy ( owner : any , gc_handle : GCHandle , skipManaged ?: boolean ) : void {
151151 assert_js_interop ( ) ;
152152 // The JS object associated with this gc_handle has been collected by the JS GC.
153153 // As such, it's not possible for this gc_handle to be invoked by JS anymore, so
@@ -171,21 +171,21 @@ export function teardown_managed_proxy (owner: any, gc_handle: GCHandle, skipMan
171171 }
172172}
173173
174- export function assert_not_disposed ( result : any ) : GCHandle {
174+ export function assert_not_disposed ( result : any ) : GCHandle {
175175 const gc_handle = result [ js_owned_gc_handle_symbol ] ;
176176 mono_check ( gc_handle != GCHandleNull , "ObjectDisposedException" ) ;
177177 return gc_handle ;
178178}
179179
180- function _js_owned_object_finalized ( gc_handle : GCHandle ) : void {
180+ function _js_owned_object_finalized ( gc_handle : GCHandle ) : void {
181181 if ( ! loaderHelpers . is_runtime_running ( ) ) {
182182 // We're shutting down, so don't bother doing anything else.
183183 return ;
184184 }
185185 teardown_managed_proxy ( null , gc_handle ) ;
186186}
187187
188- export function _lookup_js_owned_object ( gc_handle : GCHandle ) : any {
188+ export function _lookup_js_owned_object ( gc_handle : GCHandle ) : any {
189189 if ( ! gc_handle )
190190 return null ;
191191 const wr = _js_owned_object_table . get ( gc_handle ) ;
@@ -197,7 +197,7 @@ export function _lookup_js_owned_object (gc_handle: GCHandle): any {
197197 return null ;
198198}
199199
200- export function assertNoProxies ( ) : void {
200+ export function assertNoProxies ( ) : void {
201201 if ( ! WasmEnableThreads ) return ;
202202 mono_assert ( _js_owned_object_table . size === 0 , "There should be no proxies on this thread." ) ;
203203 mono_assert ( _cs_owned_objects_by_js_handle . length === 1 , "There should be no proxies on this thread." ) ;
@@ -210,7 +210,7 @@ let force_dispose_proxies_in_progress = false;
210210
211211// when we arrive here from UninstallWebWorkerInterop, the C# will unregister the handles too.
212212// when called from elsewhere, C# side could be unbalanced!!
213- export function forceDisposeProxies ( disposeMethods : boolean , verbose : boolean ) : void {
213+ export function forceDisposeProxies ( disposeMethods : boolean , verbose : boolean ) : void {
214214 let keepSomeCsAlive = false ;
215215 let keepSomeJsAlive = false ;
216216 force_dispose_proxies_in_progress = true ;
0 commit comments