Evict BitmapCanvas(s) from cache when canvas allocation fails (flutter/engine#16793)

This commit is contained in:
Ferhat 2020-02-25 13:38:25 -08:00 committed by GitHub
parent 94c31a6e2a
commit 0e20dc802c

View File

@ -95,6 +95,14 @@ class _CanvasPool extends _SaveStackTracking {
width: _widthInBitmapPixels,
height: _heightInBitmapPixels,
);
if (_canvas == null) {
// Evict BitmapCanvas(s) and retry.
_reduceCanvasMemoryUsage();
_canvas = html.CanvasElement(
width: _widthInBitmapPixels,
height: _heightInBitmapPixels,
);
}
_canvas.style
..position = 'absolute'
..width = '${cssWidth}px'