Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a8a75e7

Browse files
authored
Make toJS'd function use JS types (#44469)
JSFunction's should only accept and return JS types. Allows landing of external restrictions here: https://dart-review.googlesource.com/c/sdk/+/316867/9
1 parent f260e6d commit a8a75e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/web_ui/lib/src/engine/canvaskit/native_memory.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import 'package:ui/src/engine.dart';
2121
/// 5. The finalizer function is called with the SkPaint as the sole argument.
2222
/// 6. We call `delete` on SkPaint.
2323
DomFinalizationRegistry _finalizationRegistry = createDomFinalizationRegistry(
24-
(UniqueRef<Object> uniq) {
24+
(JSBoxedDartObject boxedUniq) {
25+
final UniqueRef<Object> uniq = boxedUniq.toDart as UniqueRef<Object>;
2526
uniq.collect();
2627
}.toJS
2728
);
@@ -33,7 +34,7 @@ NativeMemoryFinalizationRegistry nativeMemoryFinalizationRegistry = NativeMemory
3334
class NativeMemoryFinalizationRegistry {
3435
void register(Object owner, UniqueRef<Object> ref) {
3536
if (browserSupportsFinalizationRegistry) {
36-
_finalizationRegistry.register(owner, ref);
37+
_finalizationRegistry.register(owner, ref.toJSBox);
3738
}
3839
}
3940
}

0 commit comments

Comments
 (0)