This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -3392,7 +3392,7 @@ abstract class Collector {
33923392class ProductionCollector implements Collector {
33933393 ProductionCollector () {
33943394 _skObjectFinalizationRegistry =
3395- SkObjectFinalizationRegistry ((SkDeletable deletable) {
3395+ createSkObjectFinalizationRegistry ((SkDeletable deletable) {
33963396 // This is called when GC decides to collect the wrapper object and
33973397 // notify us, which may happen after the object is already deleted
33983398 // explicitly, e.g. when its ref count drops to zero. When that happens
@@ -3568,13 +3568,13 @@ extension JsConstructorExtension on JsConstructor {
35683568/// 6. We call `delete` on SkPaint.
35693569@JS ('window.FinalizationRegistry' )
35703570@staticInterop
3571- class SkObjectFinalizationRegistry {
3572- factory SkObjectFinalizationRegistry ( JSFunction cleanup) {
3573- return js_util. callConstructor (
3574- _finalizationRegistryConstructor ! .toObjectShallow,
3575- < Object > [cleanup] ,
3576- );
3577- }
3571+ class SkObjectFinalizationRegistry {}
3572+
3573+ SkObjectFinalizationRegistry createSkObjectFinalizationRegistry ( JSFunction cleanup) {
3574+ return js_util. callConstructor (
3575+ _finalizationRegistryConstructor ! .toObjectShallow ,
3576+ < Object > [cleanup],
3577+ );
35783578}
35793579
35803580extension SkObjectFinalizationRegistryExtension on SkObjectFinalizationRegistry {
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import 'canvaskit_api.dart';
1111
1212/// Collects native objects that weren't explicitly disposed of using
1313/// [UniqueRef.dispose] or [CountedRef.unref] .
14- SkObjectFinalizationRegistry _finalizationRegistry = SkObjectFinalizationRegistry (
14+ SkObjectFinalizationRegistry _finalizationRegistry = createSkObjectFinalizationRegistry (
1515 (UniqueRef <Object > uniq) {
1616 uniq.collect ();
1717 }.toJS
Original file line number Diff line number Diff line change @@ -1900,7 +1900,7 @@ void _paragraphTests() {
19001900 // FinalizationRegistry because it depends on GC, which cannot be controlled,
19011901 // So the test simply tests that a FinalizationRegistry can be constructed
19021902 // and its `register` method can be called.
1903- final SkObjectFinalizationRegistry registry = SkObjectFinalizationRegistry ((String arg) {}.toJS);
1903+ final SkObjectFinalizationRegistry registry = createSkObjectFinalizationRegistry ((String arg) {}.toJS);
19041904 registry.register (Object (), Object ());
19051905 });
19061906}
You can’t perform that action at this time.
0 commit comments