Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c9e51d0

Browse files
authored
Make GetAllocationSize const (#18713)
1 parent 3d62190 commit c9e51d0

File tree

12 files changed

+12
-12
lines changed

12 files changed

+12
-12
lines changed

lib/ui/painting/engine_layer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ EngineLayer::EngineLayer(std::shared_ptr<flutter::ContainerLayer> layer)
1818

1919
EngineLayer::~EngineLayer() = default;
2020

21-
size_t EngineLayer::GetAllocationSize() {
21+
size_t EngineLayer::GetAllocationSize() const {
2222
// Provide an approximation of the total memory impact of this object to the
2323
// Dart GC. The ContainerLayer may hold references to a tree of other layers,
2424
// which in turn may contain Skia objects.

lib/ui/painting/engine_layer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class EngineLayer : public RefCountedDartWrappable<EngineLayer> {
2323
public:
2424
~EngineLayer() override;
2525

26-
size_t GetAllocationSize() override;
26+
size_t GetAllocationSize() const override;
2727

2828
static fml::RefPtr<EngineLayer> MakeRetained(
2929
std::shared_ptr<flutter::ContainerLayer> layer) {

lib/ui/painting/image.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void CanvasImage::dispose() {
4040
ClearDartWrapper();
4141
}
4242

43-
size_t CanvasImage::GetAllocationSize() {
43+
size_t CanvasImage::GetAllocationSize() const {
4444
if (auto image = image_.get()) {
4545
const auto& info = image->imageInfo();
4646
const auto kMipmapOverhead = 4.0 / 3.0;

lib/ui/painting/image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CanvasImage final : public RefCountedDartWrappable<CanvasImage> {
3939
image_ = std::move(image);
4040
}
4141

42-
size_t GetAllocationSize() override;
42+
size_t GetAllocationSize() const override;
4343

4444
static void RegisterNatives(tonic::DartLibraryNatives* natives);
4545

lib/ui/painting/picture.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void Picture::dispose() {
5454
ClearDartWrapper();
5555
}
5656

57-
size_t Picture::GetAllocationSize() {
57+
size_t Picture::GetAllocationSize() const {
5858
if (auto picture = picture_.get()) {
5959
return picture->approximateBytesUsed();
6060
} else {

lib/ui/painting/picture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Picture : public RefCountedDartWrappable<Picture> {
3434

3535
void dispose();
3636

37-
size_t GetAllocationSize() override;
37+
size_t GetAllocationSize() const override;
3838

3939
static void RegisterNatives(tonic::DartLibraryNatives* natives);
4040

lib/ui/painting/single_frame_codec.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Dart_Handle SingleFrameCodec::getNextFrame(Dart_Handle callback_handle) {
101101
return Dart_Null();
102102
}
103103

104-
size_t SingleFrameCodec::GetAllocationSize() {
104+
size_t SingleFrameCodec::GetAllocationSize() const {
105105
const auto& data = descriptor_.data;
106106
const auto data_byte_size = data ? data->size() : 0;
107107
const auto frame_byte_size = (cached_frame_ && cached_frame_->image())

lib/ui/painting/single_frame_codec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SingleFrameCodec : public Codec {
2828
Dart_Handle getNextFrame(Dart_Handle args) override;
2929

3030
// |DartWrappable|
31-
size_t GetAllocationSize() override;
31+
size_t GetAllocationSize() const override;
3232

3333
private:
3434
enum class Status { kNew, kInProgress, kComplete };

lib/ui/text/paragraph.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Paragraph::Paragraph(std::unique_ptr<txt::Paragraph> paragraph)
4444

4545
Paragraph::~Paragraph() = default;
4646

47-
size_t Paragraph::GetAllocationSize() {
47+
size_t Paragraph::GetAllocationSize() const {
4848
// We don't have an accurate accounting of the paragraph's memory consumption,
4949
// so return a fixed size to indicate that its impact is more than the size
5050
// of the Paragraph class.

lib/ui/text/paragraph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Paragraph : public RefCountedDartWrappable<Paragraph> {
5353
Dart_Handle getLineBoundary(unsigned offset);
5454
tonic::Float64List computeLineMetrics();
5555

56-
size_t GetAllocationSize() override;
56+
size_t GetAllocationSize() const override;
5757

5858
static void RegisterNatives(tonic::DartLibraryNatives* natives);
5959

0 commit comments

Comments
 (0)