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

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: Reverting some behavior changes 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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 ASSERT(!m_actualAttributes.premultipliedAlpha); 876 ASSERT(!m_actualAttributes.premultipliedAlpha);
877 width = size().width(); 877 width = size().width();
878 height = size().height(); 878 height = size().height();
879 879
880 Checked<int, RecordOverflow> dataSize = 4; 880 Checked<int, RecordOverflow> dataSize = 4;
881 dataSize *= width; 881 dataSize *= width;
882 dataSize *= height; 882 dataSize *= height;
883 if (dataSize.hasOverflowed()) 883 if (dataSize.hasOverflowed())
884 return false; 884 return false;
885 885
886 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize); 886 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize, WTF::ArrayBufferContents:: NullDataIfOutOfMemory);
887 887
888 GLint fbo = 0; 888 GLint fbo = 0;
889 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) { 889 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) {
890 fbo = m_context->createFramebuffer(); 890 fbo = m_context->createFramebuffer();
891 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo); 891 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo);
892 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_frontColorBuffer.texInfo.textureId, 0); 892 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_frontColorBuffer.texInfo.textureId, 0);
893 } else { 893 } else {
894 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer()); 894 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer());
895 } 895 }
896 896
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) 1017 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info)
1018 { 1018 {
1019 if (info->imageId) { 1019 if (info->imageId) {
1020 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); 1020 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId);
1021 m_context->destroyImageCHROMIUM(info->imageId); 1021 m_context->destroyImageCHROMIUM(info->imageId);
1022 info->imageId = 0; 1022 info->imageId = 0;
1023 } 1023 }
1024 } 1024 }
1025 1025
1026 } // namespace blink 1026 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698