-
Notifications
You must be signed in to change notification settings - Fork 6k
Conversation
return RefCountedSkiaObjectBox._(wrapper, skObject, _refs); | ||
} | ||
|
||
/// Removes the reference count for the [skObject]. |
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.
"Removes the reference count" doesn't sound right. Maybe "Decrement the reference count" or "Remove this box from reference list"?
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 and done.
/// | ||
/// The [delete] method may be called any number of times. The box | ||
/// will only delete the object once. | ||
class RefCountedSkiaObjectBox extends SkiaObjectBox { |
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.
The image classes are the only users of SkiaObjectBox
. Can we just make SkiaObjectBox
ref-counted and not have two classes?
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.
|
||
CkAnimatedImage._(this._skAnimatedImage, SkiaObjectBox? boxToClone) { | ||
if (boxToClone != null) { | ||
box = boxToClone.clone(this); |
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.
Should we assert that the image in boxToClone
and _skAnimatedImage
are the same?
Alternatively, we could split this into two specialized constructors.
|
||
CkImage._(this.skImage, SkiaObjectBox? boxToClone) { | ||
if (boxToClone != null) { | ||
box = boxToClone.clone(this); |
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.
same comment as in CkAnimatedImage
.
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.
Added these asserts
Changes since last time: - Test for CanvasKit image rendering (flutter#67176) - Fix CanvasKit dispose impl (flutter/engine#21555) - Update internal google3 customer with a problematic ImageStream Listener impl (cl/335091311) This reverts commit 473358d.
* Reland dispose images when done (#67100) Changes since last time: - Test for CanvasKit image rendering (#67176) - Fix CanvasKit dispose impl (flutter/engine#21555) - Update internal google3 customer with a problematic ImageStream Listener impl (cl/335091311, cl/335459002) This reverts commit 473358d.
Description
Implements
Image.dispose
andImage.clone
properly so that flutter/flutter#67100 can be relanded.Creates a
RefCountedSkiaObjectBox
subclass ofSkiaObjectBox
to support this.Related Issues
flutter/flutter#67100
flutter/flutter#66688
flutter/flutter#56482
#21057
Tests
I added the following tests:
Tests that
Image.dispose
andImage.clone
/Image.isCloneOf
work properly.Tests for
clone
and stacktrace functionality onRefCountedSkiaObjectBox
.