From 21cce7e262cedce5f672e83fd38d913abff9be3d Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 16 Dec 2019 16:19:12 -0800 Subject: [PATCH] Forward low memory notifications from the shell to DartVM. --- shell/common/shell.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shell/common/shell.cc b/shell/common/shell.cc index bef72617c2bd6..fc7833fcbfb70 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -393,6 +393,12 @@ Shell::~Shell() { } void Shell::NotifyLowMemoryWarning() const { + // This does not require a current isolate but does require a running VM. + // Since a valid shell will not be returned to the embedder without a valid + // DartVMRef, we can be certain that this is a safe spot to assume a VM is + // running. + ::Dart_NotifyLowMemory(); + task_runners_.GetGPUTaskRunner()->PostTask( [rasterizer = rasterizer_->GetWeakPtr()]() { if (rasterizer) {