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

Commit 35d7d4a

Browse files
authored
Make Shell::NotifyLowMemoryWarning trace (#19283)
1 parent 268532b commit 35d7d4a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

shell/common/shell.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,17 +431,22 @@ Shell::~Shell() {
431431
}
432432

433433
void Shell::NotifyLowMemoryWarning() const {
434+
auto trace_id = fml::tracing::TraceNonce();
435+
TRACE_EVENT_ASYNC_BEGIN0("flutter", "Shell::NotifyLowMemoryWarning",
436+
trace_id);
434437
// This does not require a current isolate but does require a running VM.
435438
// Since a valid shell will not be returned to the embedder without a valid
436439
// DartVMRef, we can be certain that this is a safe spot to assume a VM is
437440
// running.
438441
::Dart_NotifyLowMemory();
439442

440443
task_runners_.GetRasterTaskRunner()->PostTask(
441-
[rasterizer = rasterizer_->GetWeakPtr()]() {
444+
[rasterizer = rasterizer_->GetWeakPtr(), trace_id = trace_id]() {
442445
if (rasterizer) {
443446
rasterizer->NotifyLowMemoryWarning();
444447
}
448+
TRACE_EVENT_ASYNC_END0("flutter", "Shell::NotifyLowMemoryWarning",
449+
trace_id);
445450
});
446451
// The IO Manager uses resource cache limits of 0, so it is not necessary
447452
// to purge them.

0 commit comments

Comments
 (0)