File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -895,7 +895,17 @@ class PipelineOwner with DiagnosticableTreeMixin {
895
895
this .onSemanticsOwnerCreated,
896
896
this .onSemanticsUpdate,
897
897
this .onSemanticsOwnerDisposed,
898
- });
898
+ }){
899
+ // TODO(polina-c): stop duplicating code across disposables
900
+ // https://github.com/flutter/flutter/issues/137435
901
+ if (kFlutterMemoryAllocationsEnabled) {
902
+ MemoryAllocations .instance.dispatchObjectCreated (
903
+ library: 'package:flutter/rendering.dart' ,
904
+ className: '$PipelineOwner ' ,
905
+ object: this ,
906
+ );
907
+ }
908
+ }
899
909
900
910
/// Called when a render object associated with this pipeline owner wishes to
901
911
/// update its visual appearance.
@@ -1433,6 +1443,9 @@ class PipelineOwner with DiagnosticableTreeMixin {
1433
1443
assert (rootNode == null );
1434
1444
assert (_manifold == null );
1435
1445
assert (_debugParent == null );
1446
+ if (kFlutterMemoryAllocationsEnabled) {
1447
+ MemoryAllocations .instance.dispatchObjectDisposed (object: this );
1448
+ }
1436
1449
_semanticsOwner? .dispose ();
1437
1450
_semanticsOwner = null ;
1438
1451
_nodesNeedingLayout.clear ();
Original file line number Diff line number Diff line change @@ -8,12 +8,20 @@ import 'package:flutter/foundation.dart';
8
8
import 'package:flutter/material.dart' ;
9
9
import 'package:flutter/rendering.dart' ;
10
10
import 'package:flutter_test/flutter_test.dart' ;
11
+ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart' ;
11
12
12
13
import 'rendering_tester.dart' ;
13
14
14
15
void main () {
15
16
TestRenderingFlutterBinding .ensureInitialized ();
16
17
18
+ test ('PipelineOwner dispatches memory events' , () async {
19
+ await expectLater (
20
+ await memoryEvents (() => PipelineOwner ().dispose (), PipelineOwner ),
21
+ areCreateAndDispose,
22
+ );
23
+ });
24
+
17
25
test ('ensure frame is scheduled for markNeedsSemanticsUpdate' , () {
18
26
// Initialize all bindings because owner.flushSemantics() requires a window
19
27
final TestRenderObject renderObject = TestRenderObject ();
You can’t perform that action at this time.
0 commit comments