Index: third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp |
index 06088dc9d96fd00d3197d204eef963a114bd624c..643c769c2dbd32eeace3838d06fafc46d10ab3f1 100644 |
--- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp |
@@ -54,6 +54,7 @@ |
#include "third_party/skia/include/core/SkPicture.h" |
#include "wtf/ArrayBufferContents.h" |
#include "wtf/MathExtras.h" |
+#include "wtf/PartitionAlloc.h" |
#include "wtf/Vector.h" |
#include "wtf/text/Base64.h" |
#include "wtf/text/WTFString.h" |
@@ -290,7 +291,9 @@ bool ImageBuffer::getImageData(Multiply multiplied, const IntRect& rect, WTF::Ar |
return false; |
if (!isSurfaceValid()) { |
- WTF::ArrayBufferContents result(rect.width() * rect.height(), 4, WTF::ArrayBufferContents::NotShared, WTF::ArrayBufferContents::ZeroInitialize); |
+ WTF::ArrayBufferContents result(rect.width() * rect.height(), 4, WTF::ArrayBufferContents::NotShared, WTF::ArrayBufferContents::ZeroInitialize, WTF::ArrayBufferContents::NullDataIfOutOfMemory); |
+ if (!result.data()) |
+ return false; |
result.transfer(contents); |
return true; |
} |
@@ -311,7 +314,11 @@ bool ImageBuffer::getImageData(Multiply multiplied, const IntRect& rect, WTF::Ar |
WTF::ArrayBufferContents::NotShared, |
mayHaveStrayArea |
? WTF::ArrayBufferContents::ZeroInitialize |
- : WTF::ArrayBufferContents::DontInitialize); |
+ : WTF::ArrayBufferContents::DontInitialize, |
+ WTF::ArrayBufferContents::NullDataIfOutOfMemory); |
+ |
+ if (!result.data()) |
+ return false; |
SkAlphaType alphaType = (multiplied == Premultiplied) ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; |
SkImageInfo info = SkImageInfo::Make(rect.width(), rect.height(), kRGBA_8888_SkColorType, alphaType); |