Skip to content

Commit

Permalink
Reland "Clean up stale cache entries in Skia's GrContext" (flutter#6867)
Browse files Browse the repository at this point in the history
Check for software rendering modes that do not have a GrContext
  • Loading branch information
jason-simmons authored Nov 15, 2018
1 parent e6f22b7 commit d8b52ef
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>()) {}
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit d8b52ef

Please sign in to comment.