Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
684980e9
Unverified
Commit
684980e9
authored
Nov 15, 2023
by
Binni Goel
Committed by
GitHub
Nov 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SemanticOwner should dispatch creation and disposal events (#138388)
parent
0f42d194
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
semantics.dart
packages/flutter/lib/src/semantics/semantics.dart
+14
-1
semantics_test.dart
packages/flutter/test/semantics/semantics_test.dart
+11
-0
No files found.
packages/flutter/lib/src/semantics/semantics.dart
View file @
684980e9
...
...
@@ -3281,7 +3281,17 @@ class SemanticsOwner extends ChangeNotifier {
/// Creates a [SemanticsOwner] that manages zero or more [SemanticsNode] objects.
SemanticsOwner
({
required
this
.
onSemanticsUpdate
,
});
}){
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectCreated
(
library
:
'package:flutter/semantics.dart'
,
className:
'
$SemanticsOwner
'
,
object:
this
,
);
}
}
/// The [onSemanticsUpdate] callback is expected to dispatch [SemanticsUpdate]s
/// to the [FlutterView] that is associated with this [PipelineOwner] and/or
...
...
@@ -3302,6 +3312,9 @@ class SemanticsOwner extends ChangeNotifier {
@override
void
dispose
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectDisposed
(
object:
this
);
}
_dirtyNodes
.
clear
();
_nodes
.
clear
();
_detachedNodes
.
clear
();
...
...
packages/flutter/test/semantics/semantics_test.dart
View file @
684980e9
...
...
@@ -6,6 +6,7 @@ import 'dart:ui';
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'../rendering/rendering_tester.dart'
;
...
...
@@ -965,6 +966,16 @@ void main() {
expect
(
config
.
onTap
,
same
(
onTap
));
expect
(
config
.
customSemanticsActions
[
customAction
],
same
(
onCustomAction
));
});
test
(
'SemanticsOwner dispatches memory events'
,
()
async
{
await
expectLater
(
await
memoryEvents
(()
=>
SemanticsOwner
(
onSemanticsUpdate:
(
SemanticsUpdate
update
)
{},
).
dispose
(),
SemanticsOwner
),
areCreateAndDispose
,
);
});
}
class
TestRender
extends
RenderProxyBox
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment