Index: Source/modules/canvas2d/CanvasRenderingContext2D.cpp |
diff --git a/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/Source/modules/canvas2d/CanvasRenderingContext2D.cpp |
index 4e3e06d2f42195553adec4d946b0c6b8eb677e55..41d48fe8be8d093508a6b6f92642f749708b670b 100644 |
--- a/Source/modules/canvas2d/CanvasRenderingContext2D.cpp |
+++ b/Source/modules/canvas2d/CanvasRenderingContext2D.cpp |
@@ -1353,20 +1353,6 @@ |
c->restoreToCount(initialSaveCount); |
} |
-bool shouldDisableDeferral(CanvasImageSource* imageSource) |
-{ |
- if (imageSource->isVideoElement()) |
- return true; |
- if (imageSource->isCanvasElement()) { |
- HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(imageSource); |
- if (canvas->is3D()) |
- return true; |
- if (canvas->isAnimated2D()) |
- return true; |
- } |
- return false; |
-} |
- |
void CanvasRenderingContext2D::drawImage(CanvasImageSource* imageSource, |
float sx, float sy, float sw, float sh, |
float dx, float dy, float dw, float dh, ExceptionState& exceptionState) |
@@ -1402,7 +1388,12 @@ |
if (srcRect.isEmpty()) |
return; |
- if (shouldDisableDeferral(imageSource)) |
+ // FIXME: crbug.com/521001 |
+ // We make the destination canvas fall out of display list mode by forcing |
+ // immediate rendering. This is to prevent run-away memory consumption caused by SkSurface |
+ // copyOnWrite when the source canvas is animated and consumed at a rate higher than the |
+ // presentation frame rate of the destination canvas. |
+ if (imageSource->isVideoElement() || imageSource->isCanvasElement()) |
canvas()->disableDeferral(); |
validateStateStack(); |