From 32b1182b0bdfb3dc8dbd5fe6be3f532d64bacd72 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 12 Jun 2018 15:34:23 -0400 Subject: [PATCH] Expose approximateBytesUsed for Picture (flutter/engine#5378) --- engine/src/flutter/lib/ui/painting.dart | 6 ++++++ engine/src/flutter/lib/ui/painting/picture.cc | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) 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)