-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] expire ImageDecoder after inactivity; implement toByteData #30224
Conversation
| late ui.VoidCallback callback; | ||
| /// | ||
| /// If this is null, the alarm goes off without calling the callback. Set the | ||
| /// callback to null of the callback is a closure holding onto expensive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: /// callback to null -if- the callback is a closure holding onto expensive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
|
||
| _cachedWebDecoder = webDecoder; | ||
|
|
||
| // Expire the decoder if it not used for several seconds. If the image is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: // Expire the decoder if -it's- not used for several seconds. If the image is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| @override | ||
| late int repetitionCount; | ||
|
|
||
| /// Whether this decoded has been disposed of. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: /// Whether this -decoder- has been disposed of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| ..width = width | ||
| ..height = height; | ||
| final html.CanvasRenderingContext2D ctx = canvas.context2D; | ||
| drawVideoFrame(ctx, videoFrame, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, you can do:
ctx.drawImage(videoFrame, 0, 0);but you probably have to make VideoFrame implements CanvasImageSource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Done.
a5dce05 to
8c1225c
Compare
ImageDecoderafter 3 seconds of inactivity (fixes [Web] Gridview with images has significant memory leak flutter#94500)toByteDatafor images decoded usingImageDecoder(this may be temporary https://bugs.chromium.org/p/skia/issues/detail?id=12721)