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

Commit c176244

Browse files
Provide an estimate of EngineLayer memory usage to the Dart GC (#6589)
See flutter/flutter#23171
1 parent 2511dec commit c176244

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/ui/painting/engine_layer.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ namespace blink {
1717

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

20+
size_t EngineLayer::GetAllocationSize() {
21+
// Provide an approximation of the total memory impact of this object to the
22+
// Dart GC. The ContainerLayer may hold references to a tree of other layers,
23+
// which in turn may contain Skia objects.
24+
return 3000;
25+
};
26+
2027
IMPLEMENT_WRAPPERTYPEINFO(ui, EngineLayer);
2128

2229
#define FOR_EACH_BINDING(V) // nothing to bind

lib/ui/painting/engine_layer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class EngineLayer : public RefCountedDartWrappable<EngineLayer> {
2222

2323
public:
2424
~EngineLayer() override;
25+
26+
size_t GetAllocationSize() override;
27+
2528
static fml::RefPtr<EngineLayer> MakeRetained(
2629
std::shared_ptr<flow::ContainerLayer> layer) {
2730
return fml::MakeRefCounted<EngineLayer>(layer);

0 commit comments

Comments
 (0)