Reland "Clean up stale cache entries in Skia's GrContext" (flutter/engine#6867)

Check for software rendering modes that do not have a GrContext
This commit is contained in:
Jason Simmons
2018-11-15 14:24:36 -08:00
committed by GitHub
parent ed65ad873b
commit 76d8335949

View File

@@ -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<flow::CompositorContext>()) {}
@@ -186,6 +190,10 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) {
external_view_embedder->SubmitFrame(surface_->GetContext());
}
FireNextFrameCallbackIfPresent();
if (surface_->GetContext())
surface_->GetContext()->performDeferredCleanup(kSkiaCleanupExpiration);
return true;
}