Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and applied senorblanco+haraken feedbac Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 ASSERT(!m_actualAttributes.premultipliedAlpha); 882 ASSERT(!m_actualAttributes.premultipliedAlpha);
883 width = size().width(); 883 width = size().width();
884 height = size().height(); 884 height = size().height();
885 885
886 Checked<int, RecordOverflow> dataSize = 4; 886 Checked<int, RecordOverflow> dataSize = 4;
887 dataSize *= width; 887 dataSize *= width;
888 dataSize *= height; 888 dataSize *= height;
889 if (dataSize.hasOverflowed()) 889 if (dataSize.hasOverflowed())
890 return false; 890 return false;
891 891
892 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize); 892 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize, WTF::ArrayBufferContents:: NullDataIfOutOfMemory);
893 893
894 GLint fbo = 0; 894 GLint fbo = 0;
895 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) { 895 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) {
896 fbo = m_context->createFramebuffer(); 896 fbo = m_context->createFramebuffer();
897 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo); 897 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo);
898 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_frontColorBuffer.texInfo.textureId, 0); 898 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_frontColorBuffer.texInfo.textureId, 0);
899 } else { 899 } else {
900 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer()); 900 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer());
901 } 901 }
902 902
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) 1023 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info)
1024 { 1024 {
1025 if (info->imageId) { 1025 if (info->imageId) {
1026 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); 1026 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId);
1027 m_context->destroyImageCHROMIUM(info->imageId); 1027 m_context->destroyImageCHROMIUM(info->imageId);
1028 info->imageId = 0; 1028 info->imageId = 0;
1029 } 1029 }
1030 } 1030 }
1031 1031
1032 } // namespace blink 1032 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698