Check If ImageBuffer is allocated before proceeding.

This patch takes care of the left out places where 
newly created ImageBuffer is not validated.

BUG= 248420

Review URL: https://codereview.chromium.org/562543004

git-svn-id: svn://svn.chromium.org/blink/trunk@181936 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 930d43cf
......@@ -131,6 +131,8 @@ static bool createImageBuffer(const Filter* filter, OwnPtr<ImageBuffer>& imageBu
if (!surface->isValid())
return false;
OwnPtr<ImageBuffer> image = ImageBuffer::create(surface.release());
if (!image)
return false;
GraphicsContext* imageContext = image->context();
ASSERT(imageContext);
......
......@@ -243,6 +243,7 @@ TEST(GraphicsContextTest, trackImageMask)
context.beginTransparencyLayer(1);
OwnPtr<ImageBuffer> alphaImage = ImageBuffer::create(IntSize(100, 100));
EXPECT_FALSE(!alphaImage);
alphaImage->context()->fillRect(IntRect(0, 0, 100, 100), alpha);
context.setCompositeOperation(CompositeSourceOver);
......@@ -280,6 +281,7 @@ TEST(GraphicsContextTest, trackImageMaskWithOpaqueRect)
context.beginTransparencyLayer(1);
OwnPtr<ImageBuffer> alphaImage = ImageBuffer::create(IntSize(100, 100));
EXPECT_FALSE(!alphaImage);
alphaImage->context()->fillRect(IntRect(0, 0, 100, 100), alpha);
context.setCompositeOperation(CompositeSourceOver);
......
......@@ -84,6 +84,7 @@ protected:
// We create an ImageBuffer in order for the testSurface to be
// properly initialized with a GraphicsContext
m_imageBuffer = ImageBuffer::create(testSurface.release());
EXPECT_FALSE(!m_imageBuffer);
m_fakeImageBufferClient = adoptPtr(new FakeImageBufferClient(m_imageBuffer.get()));
m_imageBuffer->setClient(m_fakeImageBufferClient.get());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment