Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion shell/common/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -431,17 +431,22 @@ Shell::~Shell() {
}

void Shell::NotifyLowMemoryWarning() const {
auto trace_id = fml::tracing::TraceNonce();
TRACE_EVENT_ASYNC_BEGIN0("flutter", "Shell::NotifyLowMemoryWarning",
trace_id);
// 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_.GetRasterTaskRunner()->PostTask(
[rasterizer = rasterizer_->GetWeakPtr()]() {
[rasterizer = rasterizer_->GetWeakPtr(), trace_id = trace_id]() {
if (rasterizer) {
rasterizer->NotifyLowMemoryWarning();
}
TRACE_EVENT_ASYNC_END0("flutter", "Shell::NotifyLowMemoryWarning",
trace_id);
});
// The IO Manager uses resource cache limits of 0, so it is not necessary
// to purge them.
Expand Down