Provide an estimate of EngineLayer memory usage to the Dart GC (flutter/engine#6589)
See https://github.com/flutter/flutter/issues/23171
This commit is contained in:
@@ -17,6 +17,13 @@ namespace blink {
|
||||
|
||||
EngineLayer::~EngineLayer() = default;
|
||||
|
||||
size_t EngineLayer::GetAllocationSize() {
|
||||
// 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.
|
||||
return 3000;
|
||||
};
|
||||
|
||||
IMPLEMENT_WRAPPERTYPEINFO(ui, EngineLayer);
|
||||
|
||||
#define FOR_EACH_BINDING(V) // nothing to bind
|
||||
|
||||
@@ -22,6 +22,9 @@ class EngineLayer : public RefCountedDartWrappable<EngineLayer> {
|
||||
|
||||
public:
|
||||
~EngineLayer() override;
|
||||
|
||||
size_t GetAllocationSize() override;
|
||||
|
||||
static fml::RefPtr<EngineLayer> MakeRetained(
|
||||
std::shared_ptr<flow::ContainerLayer> layer) {
|
||||
return fml::MakeRefCounted<EngineLayer>(layer);
|
||||
|
||||
Reference in New Issue
Block a user