This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 3 files changed +6
-21
lines changed
3 files changed +6
-21
lines changed Original file line number Diff line number Diff line change @@ -3569,12 +3569,9 @@ extension JsConstructorExtension on JsConstructor {
3569
3569
@JS ('window.FinalizationRegistry' )
3570
3570
@staticInterop
3571
3571
class SkObjectFinalizationRegistry {
3572
- factory SkObjectFinalizationRegistry (JSFunction cleanup) {
3573
- return js_util.callConstructor (
3574
- _finalizationRegistryConstructor! .toObjectShallow,
3575
- < Object > [cleanup],
3576
- );
3577
- }
3572
+ // TODO(hterkelsen): Add a type for the `cleanup` function when
3573
+ // native constructors support type parameters.
3574
+ external factory SkObjectFinalizationRegistry (JSFunction cleanup);
3578
3575
}
3579
3576
3580
3577
extension SkObjectFinalizationRegistryExtension on SkObjectFinalizationRegistry {
Original file line number Diff line number Diff line change @@ -11,11 +11,9 @@ import 'canvaskit_api.dart';
11
11
12
12
/// Collects native objects that weren't explicitly disposed of using
13
13
/// [UniqueRef.dispose] or [CountedRef.unref] .
14
- SkObjectFinalizationRegistry _finalizationRegistry = SkObjectFinalizationRegistry (
15
- (UniqueRef <Object > uniq) {
16
- uniq.collect ();
17
- }.toJS
18
- );
14
+ SkObjectFinalizationRegistry _finalizationRegistry = SkObjectFinalizationRegistry ((UniqueRef <Object > uniq) {
15
+ uniq.collect ();
16
+ }.toJS);
19
17
20
18
NativeMemoryFinalizationRegistry nativeMemoryFinalizationRegistry = NativeMemoryFinalizationRegistry ();
21
19
Original file line number Diff line number Diff line change 2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
- import 'dart:js_interop' ;
6
5
import 'dart:math' ;
7
6
import 'dart:typed_data' ;
8
7
@@ -1894,15 +1893,6 @@ void _paragraphTests() {
1894
1893
'http://localhost:1234/foo/canvaskit.wasm' ,
1895
1894
);
1896
1895
});
1897
-
1898
- test ('SkObjectFinalizationRegistry' , () {
1899
- // There's no reliable way to test the actual functionality of
1900
- // FinalizationRegistry because it depends on GC, which cannot be controlled,
1901
- // So the test simply tests that a FinalizationRegistry can be constructed
1902
- // and its `register` method can be called.
1903
- final SkObjectFinalizationRegistry registry = SkObjectFinalizationRegistry ((String arg) {}.toJS);
1904
- registry.register ('foo' , 'bar' );
1905
- });
1906
1896
}
1907
1897
1908
1898
You can’t perform that action at this time.
0 commit comments