From 2c6be93fa98aeb0dd3c1efa2db201232eb8eefba Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 14 Nov 2018 14:21:17 -0800 Subject: [PATCH] Clean up stale cache entries in Skia's GrContext (#6859) Fixes https://github.com/flutter/flutter/issues/24160 --- shell/common/rasterizer.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 9f3317912..67aa016c8 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -16,6 +16,10 @@ namespace shell { +// The rasterizer will tell Skia to purge cached resources that have not been +// used within this interval. +static constexpr std::chrono::milliseconds kSkiaCleanupExpiration(15000); + Rasterizer::Rasterizer(blink::TaskRunners task_runners) : Rasterizer(std::move(task_runners), std::make_unique()) {} @@ -186,6 +190,9 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) { external_view_embedder->SubmitFrame(surface_->GetContext()); } FireNextFrameCallbackIfPresent(); + + surface_->GetContext()->performDeferredCleanup(kSkiaCleanupExpiration); + return true; } -- GitLab