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
ca384b84
Unverified
Commit
ca384b84
authored
Nov 08, 2023
by
Kostia Sokolovskyi
Committed by
GitHub
Nov 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ticker should dispatch creation and disposal events. (#137844)
parent
89692884
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
ticker.dart
packages/flutter/lib/src/scheduler/ticker.dart
+15
-0
ticker_test.dart
packages/flutter/test/scheduler/ticker_test.dart
+11
-0
No files found.
packages/flutter/lib/src/scheduler/ticker.dart
View file @
ca384b84
...
...
@@ -71,6 +71,15 @@ class Ticker {
_debugCreationStack
=
StackTrace
.
current
;
return
true
;
}());
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectCreated
(
library
:
'package:flutter/scheduler.dart'
,
className:
'
$Ticker
'
,
object:
this
,
);
}
}
TickerFuture
?
_future
;
...
...
@@ -319,6 +328,12 @@ class Ticker {
/// with a [TickerCanceled] error.
@mustCallSuper
void
dispose
()
{
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectDisposed
(
object:
this
);
}
if
(
_future
!=
null
)
{
final
TickerFuture
localFuture
=
_future
!;
_future
=
null
;
...
...
packages/flutter/test/scheduler/ticker_test.dart
View file @
ca384b84
...
...
@@ -23,6 +23,7 @@ void main() {
}
final
Ticker
ticker
=
Ticker
(
handleTick
);
addTearDown
(
ticker
.
dispose
);
expect
(
ticker
.
isTicking
,
isFalse
);
expect
(
ticker
.
isActive
,
isFalse
);
...
...
@@ -100,6 +101,7 @@ void main() {
testWidgetsWithLeakTracking
(
'Ticker control test'
,
(
WidgetTester
tester
)
async
{
late
Ticker
ticker
;
addTearDown
(()
=>
ticker
.
dispose
());
void
testFunction
()
{
ticker
=
Ticker
((
Duration
_
)
{
});
...
...
@@ -154,6 +156,7 @@ void main() {
}
final
Ticker
ticker
=
Ticker
(
handleTick
);
addTearDown
(
ticker
.
dispose
);
ticker
.
start
();
expect
(
ticker
.
isTicking
,
isTrue
);
...
...
@@ -179,6 +182,7 @@ void main() {
}
final
Ticker
ticker
=
Ticker
(
handleTick
);
addTearDown
(
ticker
.
dispose
);
ticker
.
start
();
expect
(
tickCount
,
equals
(
0
));
...
...
@@ -198,4 +202,11 @@ void main() {
ticker
.
stop
();
});
test
(
'Ticker dispatches memory events'
,
()
async
{
await
expectLater
(
await
memoryEvents
(()
=>
Ticker
((
_
)
{}).
dispose
(),
Ticker
,),
areCreateAndDispose
,
);
});
}
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