diff --git a/lib/ui/painting/engine_layer.cc b/lib/ui/painting/engine_layer.cc index 0868b42cc2928..4504ac278e618 100644 --- a/lib/ui/painting/engine_layer.cc +++ b/lib/ui/painting/engine_layer.cc @@ -18,7 +18,7 @@ EngineLayer::EngineLayer(std::shared_ptr layer) EngineLayer::~EngineLayer() = default; -size_t EngineLayer::GetAllocationSize() { +size_t EngineLayer::GetAllocationSize() const { // Provide an approximation of the total memory impact of this object to the // Dart GC. The ContainerLayer may hold references to a tree of other layers, // which in turn may contain Skia objects. diff --git a/lib/ui/painting/engine_layer.h b/lib/ui/painting/engine_layer.h index 8e402ba9150f5..83f2cb16942ab 100644 --- a/lib/ui/painting/engine_layer.h +++ b/lib/ui/painting/engine_layer.h @@ -23,7 +23,7 @@ class EngineLayer : public RefCountedDartWrappable { public: ~EngineLayer() override; - size_t GetAllocationSize() override; + size_t GetAllocationSize() const override; static fml::RefPtr MakeRetained( std::shared_ptr layer) { diff --git a/lib/ui/painting/image.cc b/lib/ui/painting/image.cc index 8ee65790924bf..151d76ec6a647 100644 --- a/lib/ui/painting/image.cc +++ b/lib/ui/painting/image.cc @@ -40,7 +40,7 @@ void CanvasImage::dispose() { ClearDartWrapper(); } -size_t CanvasImage::GetAllocationSize() { +size_t CanvasImage::GetAllocationSize() const { if (auto image = image_.get()) { const auto& info = image->imageInfo(); const auto kMipmapOverhead = 4.0 / 3.0; diff --git a/lib/ui/painting/image.h b/lib/ui/painting/image.h index 516a2e5d59c49..b8bae633e6e25 100644 --- a/lib/ui/painting/image.h +++ b/lib/ui/painting/image.h @@ -39,7 +39,7 @@ class CanvasImage final : public RefCountedDartWrappable { image_ = std::move(image); } - size_t GetAllocationSize() override; + size_t GetAllocationSize() const override; static void RegisterNatives(tonic::DartLibraryNatives* natives); diff --git a/lib/ui/painting/picture.cc b/lib/ui/painting/picture.cc index 511e369d6afdc..051dd27dc1f29 100644 --- a/lib/ui/painting/picture.cc +++ b/lib/ui/painting/picture.cc @@ -54,7 +54,7 @@ void Picture::dispose() { ClearDartWrapper(); } -size_t Picture::GetAllocationSize() { +size_t Picture::GetAllocationSize() const { if (auto picture = picture_.get()) { return picture->approximateBytesUsed(); } else { diff --git a/lib/ui/painting/picture.h b/lib/ui/painting/picture.h index f6dd98887d264..093a13d2dca4d 100644 --- a/lib/ui/painting/picture.h +++ b/lib/ui/painting/picture.h @@ -34,7 +34,7 @@ class Picture : public RefCountedDartWrappable { void dispose(); - size_t GetAllocationSize() override; + size_t GetAllocationSize() const override; static void RegisterNatives(tonic::DartLibraryNatives* natives); diff --git a/lib/ui/painting/single_frame_codec.cc b/lib/ui/painting/single_frame_codec.cc index 44361f583a583..7b77b03a1b5c0 100644 --- a/lib/ui/painting/single_frame_codec.cc +++ b/lib/ui/painting/single_frame_codec.cc @@ -101,7 +101,7 @@ Dart_Handle SingleFrameCodec::getNextFrame(Dart_Handle callback_handle) { return Dart_Null(); } -size_t SingleFrameCodec::GetAllocationSize() { +size_t SingleFrameCodec::GetAllocationSize() const { const auto& data = descriptor_.data; const auto data_byte_size = data ? data->size() : 0; const auto frame_byte_size = (cached_frame_ && cached_frame_->image()) diff --git a/lib/ui/painting/single_frame_codec.h b/lib/ui/painting/single_frame_codec.h index b01638c71ce63..c3d92946ff306 100644 --- a/lib/ui/painting/single_frame_codec.h +++ b/lib/ui/painting/single_frame_codec.h @@ -28,7 +28,7 @@ class SingleFrameCodec : public Codec { Dart_Handle getNextFrame(Dart_Handle args) override; // |DartWrappable| - size_t GetAllocationSize() override; + size_t GetAllocationSize() const override; private: enum class Status { kNew, kInProgress, kComplete }; diff --git a/lib/ui/text/paragraph.cc b/lib/ui/text/paragraph.cc index 92800db2ebd67..25d773227fd97 100644 --- a/lib/ui/text/paragraph.cc +++ b/lib/ui/text/paragraph.cc @@ -44,7 +44,7 @@ Paragraph::Paragraph(std::unique_ptr paragraph) Paragraph::~Paragraph() = default; -size_t Paragraph::GetAllocationSize() { +size_t Paragraph::GetAllocationSize() const { // We don't have an accurate accounting of the paragraph's memory consumption, // so return a fixed size to indicate that its impact is more than the size // of the Paragraph class. diff --git a/lib/ui/text/paragraph.h b/lib/ui/text/paragraph.h index 73c79d3c67de3..a422d847b40e0 100644 --- a/lib/ui/text/paragraph.h +++ b/lib/ui/text/paragraph.h @@ -53,7 +53,7 @@ class Paragraph : public RefCountedDartWrappable { Dart_Handle getLineBoundary(unsigned offset); tonic::Float64List computeLineMetrics(); - size_t GetAllocationSize() override; + size_t GetAllocationSize() const override; static void RegisterNatives(tonic::DartLibraryNatives* natives); diff --git a/third_party/tonic/dart_wrappable.cc b/third_party/tonic/dart_wrappable.cc index d0906646f313b..3bdfe3e6e498a 100644 --- a/third_party/tonic/dart_wrappable.cc +++ b/third_party/tonic/dart_wrappable.cc @@ -77,7 +77,7 @@ void DartWrappable::FinalizeDartWrapper(void* isolate_callback_data, wrappable->ReleaseDartWrappableReference(); // Balanced in CreateDartWrapper. } -size_t DartWrappable::GetAllocationSize() { +size_t DartWrappable::GetAllocationSize() const { return GetDartWrapperInfo().size_in_bytes; } diff --git a/third_party/tonic/dart_wrappable.h b/third_party/tonic/dart_wrappable.h index 1d2e5e75bacb2..49b0a2c40baf3 100644 --- a/third_party/tonic/dart_wrappable.h +++ b/third_party/tonic/dart_wrappable.h @@ -37,7 +37,7 @@ class DartWrappable { // Override this to customize the object size reported to the Dart garbage // collector. // Implement using IMPLEMENT_WRAPPERTYPEINFO macro - virtual size_t GetAllocationSize(); + virtual size_t GetAllocationSize() const; virtual void RetainDartWrappableReference() const = 0;