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
39f29741
Unverified
Commit
39f29741
authored
Nov 02, 2023
by
Binni Goel
Committed by
GitHub
Nov 02, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instrument ImageStreamCompleterHandle for LeakTracking (#137482)
parent
e2d5e8fd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
image_stream.dart
packages/flutter/lib/src/painting/image_stream.dart
+16
-0
image_stream_test.dart
packages/flutter/test/painting/image_stream_test.dart
+17
-0
No files found.
packages/flutter/lib/src/painting/image_stream.dart
View file @
39f29741
...
...
@@ -8,6 +8,8 @@ import 'dart:ui' as ui show Codec, FrameInfo, Image;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/scheduler.dart'
;
const
String
_flutterWidgetsLibrary
=
'package:flutter/widgets.dart'
;
/// A [dart:ui.Image] object with its corresponding scale.
///
/// ImageInfo objects are used by [ImageStream] objects to represent the
...
...
@@ -437,6 +439,15 @@ class ImageStream with Diagnosticable {
class
ImageStreamCompleterHandle
{
ImageStreamCompleterHandle
.
_
(
ImageStreamCompleter
this
.
_completer
)
{
_completer
!.
_keepAliveHandles
+=
1
;
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectCreated
(
library
:
_flutterWidgetsLibrary
,
className:
'
$ImageStreamCompleterHandle
'
,
object:
this
,
);
}
}
ImageStreamCompleter
?
_completer
;
...
...
@@ -453,6 +464,11 @@ class ImageStreamCompleterHandle {
_completer
!.
_keepAliveHandles
-=
1
;
_completer
!.
_maybeDispose
();
_completer
=
null
;
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectDisposed
(
object:
this
);
}
}
}
...
...
packages/flutter/test/painting/image_stream_test.dart
View file @
39f29741
...
...
@@ -871,4 +871,21 @@ void main() {
expect
(
synchronouslyCalled
,
false
);
});
test
(
'ImageStreamCompleterHandle dispatches memory events'
,
()
async
{
await
expectLater
(
await
memoryEvents
(
()
{
final
StreamController
<
ImageChunkEvent
>
streamController
=
StreamController
<
ImageChunkEvent
>();
addTearDown
(
streamController
.
close
);
final
ImageStreamCompleterHandle
imageStreamCompleterHandle
=
FakeEventReportingImageStreamCompleter
(
chunkEvents:
streamController
.
stream
,
).
keepAlive
();
imageStreamCompleterHandle
.
dispose
();
},
ImageStreamCompleterHandle
,
),
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