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:
Jason Simmons
2018-10-18 12:24:10 -07:00
committed by GitHub
parent e67f046b14
commit f41ec42f57
2 changed files with 10 additions and 0 deletions

View File

@@ -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

View File

@@ -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);