diff --git a/engine/src/flutter/lib/ui/painting.dart b/engine/src/flutter/lib/ui/painting.dart index 7624b948b92..7699f847b7d 100644 --- a/engine/src/flutter/lib/ui/painting.dart +++ b/engine/src/flutter/lib/ui/painting.dart @@ -3404,6 +3404,12 @@ class Picture extends NativeFieldWrapperClass2 { /// Release the resources used by this object. The object is no longer usable /// after this method is called. void dispose() native 'Picture_dispose'; + + /// Returns the approximate number of bytes allocated for this object. + /// + /// The actual size of this picture may be larger, particularly if it contains + /// references to image or other large objects. + int get approximateBytesUsed native 'Picture_GetAllocationSize'; } /// Records a [Picture] containing a sequence of graphical operations. diff --git a/engine/src/flutter/lib/ui/painting/picture.cc b/engine/src/flutter/lib/ui/painting/picture.cc index 34f92b8c315..73e3a162545 100644 --- a/engine/src/flutter/lib/ui/painting/picture.cc +++ b/engine/src/flutter/lib/ui/painting/picture.cc @@ -18,7 +18,8 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, Picture); #define FOR_EACH_BINDING(V) \ V(Picture, toImage) \ - V(Picture, dispose) + V(Picture, dispose) \ + V(Picture, GetAllocationSize) DART_BIND_ALL(Picture, FOR_EACH_BINDING)